diff --git a/src/Api/Jobs/PostJobs/GetPostThumbJob.php b/src/Api/Jobs/PostJobs/GetPostThumbJob.php index 4b2e89d0..7b3892e4 100644 --- a/src/Api/Jobs/PostJobs/GetPostThumbJob.php +++ b/src/Api/Jobs/PostJobs/GetPostThumbJob.php @@ -29,8 +29,9 @@ class GetPostThumbJob extends AbstractJob $post = $this->postRetriever->retrieve(); $post->generateThumb($width, $height); + $path = PostModel::tryGetWorkingThumbPath($name, $width, $height); - if (!file_exists($path)) + if (!$path) { $path = getConfig()->main->mediaPath . DS . 'img' . DS . 'thumb.jpg'; $path = TextHelper::absolutePath($path); diff --git a/tests/Tests/JobTests/GetPostThumbJobTest.php b/tests/Tests/JobTests/GetPostThumbJobTest.php index 763a2b84..f3c1f9a6 100644 --- a/tests/Tests/JobTests/GetPostThumbJobTest.php +++ b/tests/Tests/JobTests/GetPostThumbJobTest.php @@ -17,6 +17,9 @@ class GetPostThumbJobTest extends AbstractTest $this->assert->isNotNull($post->tryGetWorkingFullPath()); $this->assert->areEqual('image/jpeg', $output->mimeType); + $this->assert->areNotEqual( + file_get_contents(getConfig()->main->mediaPath . DS . 'img' . DS . 'thumb.jpg'), + $output->fileContent); } public function testIdFail()