This commit is contained in:
Marcin Kurczewski 2013-10-27 19:32:48 +01:00
parent 0d360d525e
commit f726690ea3

View file

@ -414,7 +414,7 @@ class PostController
if ($imageWidth != $this->config->browsing->thumbHeight) if ($imageWidth != $this->config->browsing->thumbHeight)
throw new SimpleException('Invalid thumbnail width (should be ' . $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); move_uploaded_file($suppliedFile['tmp_name'], $path);
} }
@ -640,7 +640,9 @@ class PostController
{ {
$this->context->layoutName = 'layout-file'; $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)) if (!file_exists($path))
{ {
$post = Model_Post::locate($name); $post = Model_Post::locate($name);
@ -648,7 +650,6 @@ class PostController
PrivilegesHelper::confirmWithException(Privilege::ViewPost); PrivilegesHelper::confirmWithException(Privilege::ViewPost);
PrivilegesHelper::confirmWithException(Privilege::ViewPost, PostSafety::toString($post->safety)); PrivilegesHelper::confirmWithException(Privilege::ViewPost, PostSafety::toString($post->safety));
$srcPath = $this->config->main->filesPath . DS . $post->name; $srcPath = $this->config->main->filesPath . DS . $post->name;
$dstPath = $path;
$dstWidth = $this->config->browsing->thumbWidth; $dstWidth = $this->config->browsing->thumbWidth;
$dstHeight = $this->config->browsing->thumbHeight; $dstHeight = $this->config->browsing->thumbHeight;
@ -711,7 +712,7 @@ class PostController
throw new SimpleException('Unknown thumbnail crop style'); throw new SimpleException('Unknown thumbnail crop style');
} }
imagepng($dstImage, $dstPath); imagepng($dstImage, $path);
imagedestroy($srcImage); imagedestroy($srcImage);
imagedestroy($dstImage); imagedestroy($dstImage);
} }