From f726690ea357be170b5355e43a9bb1f874a3cab2 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sun, 27 Oct 2013 19:32:48 +0100 Subject: [PATCH] Closed #53 --- src/Controllers/PostController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Controllers/PostController.php b/src/Controllers/PostController.php index d7deee04..a62848d3 100644 --- a/src/Controllers/PostController.php +++ b/src/Controllers/PostController.php @@ -414,7 +414,7 @@ class PostController if ($imageWidth != $this->config->browsing->thumbHeight) throw new SimpleException('Invalid thumbnail width (should be ' . $this->config->browsing->thumbHeight . ')'); - $path = $this->config->main->thumbsPath . DS . $post->name; + $path = $this->config->main->thumbsPath . DS . $post->name . '.custom'; move_uploaded_file($suppliedFile['tmp_name'], $path); } @@ -640,7 +640,9 @@ class PostController { $this->context->layoutName = 'layout-file'; - $path = $this->config->main->thumbsPath . DS . $name; + $path = $this->config->main->thumbsPath . DS . $name . '.custom'; + if (!file_exists($path)) + $path = $this->config->main->thumbsPath . DS . $name . '.default'; if (!file_exists($path)) { $post = Model_Post::locate($name); @@ -648,7 +650,6 @@ class PostController PrivilegesHelper::confirmWithException(Privilege::ViewPost); PrivilegesHelper::confirmWithException(Privilege::ViewPost, PostSafety::toString($post->safety)); $srcPath = $this->config->main->filesPath . DS . $post->name; - $dstPath = $path; $dstWidth = $this->config->browsing->thumbWidth; $dstHeight = $this->config->browsing->thumbHeight; @@ -711,7 +712,7 @@ class PostController throw new SimpleException('Unknown thumbnail crop style'); } - imagepng($dstImage, $dstPath); + imagepng($dstImage, $path); imagedestroy($srcImage); imagedestroy($dstImage); }