Skip to content

Commit

Permalink
Check on empty/null filePath image (#1128)
Browse files Browse the repository at this point in the history
  • Loading branch information
melroy89 authored Sep 13, 2024
1 parent 4d930f6 commit f26b674
Showing 1 changed file with 30 additions and 12 deletions.
42 changes: 30 additions & 12 deletions src/Command/ImageCacheCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,18 @@ private function buildUsersCache(): void
->getArrayResult();

foreach ($res as $image) {
if (!$image['filePath']) {
continue;
}
$command = $this->getApplication()->find('liip:imagine:cache:resolve');

$arguments = [
'paths' => [$image['filePath']],
'--filter' => ['avatar_thumb'],
];

$greetInput = new ArrayInput($arguments);
$returnCode = $command->run($greetInput, new NullOutput());
$input = new ArrayInput($arguments);
$returnCode = $command->run($input, new NullOutput());
}
}

Expand All @@ -71,15 +74,18 @@ private function buildEntriesCache(): void
->getArrayResult();

foreach ($res as $image) {
if (!$image['filePath']) {
continue;
}
$command = $this->getApplication()->find('liip:imagine:cache:resolve');

$arguments = [
'paths' => [$image['filePath']],
'--filter' => ['entry_thumb'],
];

$greetInput = new ArrayInput($arguments);
$returnCode = $command->run($greetInput, new NullOutput());
$input = new ArrayInput($arguments);
$returnCode = $command->run($input, new NullOutput());
}
}

Expand All @@ -92,15 +98,18 @@ private function buildEntryCommentsCache(): void
->getArrayResult();

foreach ($res as $image) {
if (!$image['filePath']) {
continue;
}
$command = $this->getApplication()->find('liip:imagine:cache:resolve');

$arguments = [
'paths' => [$image['filePath']],
'--filter' => ['post_thumb'],
];

$greetInput = new ArrayInput($arguments);
$returnCode = $command->run($greetInput, new NullOutput());
$input = new ArrayInput($arguments);
$returnCode = $command->run($input, new NullOutput());
}
}

Expand All @@ -113,15 +122,18 @@ private function buildPostsCache(): void
->getArrayResult();

foreach ($res as $image) {
if (!$image['filePath']) {
continue;
}
$command = $this->getApplication()->find('liip:imagine:cache:resolve');

$arguments = [
'paths' => [$image['filePath']],
'--filter' => ['post_thumb'],
];

$greetInput = new ArrayInput($arguments);
$returnCode = $command->run($greetInput, new NullOutput());
$input = new ArrayInput($arguments);
$returnCode = $command->run($input, new NullOutput());
}
}

Expand All @@ -134,15 +146,18 @@ private function buildPostCommentsCache(): void
->getArrayResult();

foreach ($res as $image) {
if (!$image['filePath']) {
continue;
}
$command = $this->getApplication()->find('liip:imagine:cache:resolve');

$arguments = [
'paths' => [$image['filePath']],
'--filter' => ['post_thumb'],
];

$greetInput = new ArrayInput($arguments);
$returnCode = $command->run($greetInput, new NullOutput());
$input = new ArrayInput($arguments);
$returnCode = $command->run($input, new NullOutput());
}
}

Expand All @@ -155,15 +170,18 @@ private function buildMagazinesCache(): void
->getArrayResult();

foreach ($res as $image) {
if (!$image['filePath']) {
continue;
}
$command = $this->getApplication()->find('liip:imagine:cache:resolve');

$arguments = [
'paths' => [$image['filePath']],
'--filter' => ['post_thumb'],
];

$greetInput = new ArrayInput($arguments);
$returnCode = $command->run($greetInput, new NullOutput());
$input = new ArrayInput($arguments);
$returnCode = $command->run($input, new NullOutput());
}
}
}

0 comments on commit f26b674

Please sign in to comment.