Fixed thumb generating

New thumbs worked only after refreshing the page and showed placeholder
thumb prior to that. Now they load correctly without need to reload.
This commit is contained in:
Marcin Kurczewski 2014-05-13 21:21:24 +02:00
parent a38b280098
commit a2507370cc
2 changed files with 5 additions and 1 deletions

View file

@ -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);

View file

@ -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()