Reduced thumbnail size (PNG->JPG)

This commit is contained in:
Marcin Kurczewski 2013-10-29 09:18:00 +01:00
parent f119ab724a
commit cf1b5837a7
3 changed files with 5 additions and 5 deletions

View file

@ -43,7 +43,7 @@
width: 100px;
height: 100px;
line-height: 100px;
background-image: url('../img/thumb.png');
background-image: url('../img/thumb.jpg');
background-size: 100px 100px;
border: 1px solid black;
vertical-align: middle;

Binary file not shown.

After

Width:  |  Height:  |  Size: 933 B

View file

@ -582,7 +582,7 @@ class PostController
if ($post->type == PostType::Youtube)
{
$tmpPath = tempnam(sys_get_temp_dir(), 'thumb') . '.png';
$tmpPath = tempnam(sys_get_temp_dir(), 'thumb') . '.jpg';
$contents = file_get_contents('http://img.youtube.com/vi/' . $post->orig_name . '/mqdefault.jpg');
file_put_contents($tmpPath, $contents);
if (file_exists($tmpPath))
@ -639,13 +639,13 @@ class PostController
throw new SimpleException('Unknown thumbnail crop style');
}
imagepng($dstImage, $path);
imagejpeg($dstImage, $path);
imagedestroy($srcImage);
imagedestroy($dstImage);
}
else
{
$path = $this->config->main->mediaPath . DS . 'img' . DS . 'thumb.png';
$path = $this->config->main->mediaPath . DS . 'img' . DS . 'thumb.jpg';
}
if (isset($tmpPath))
@ -655,7 +655,7 @@ class PostController
throw new SimpleException('Thumbnail file is not readable');
$this->context->transport->cacheDaysToLive = 30;
$this->context->transport->mimeType = 'image/png';
$this->context->transport->mimeType = 'image/jpeg';
$this->context->transport->fileHash = 'thumb' . md5($name . filemtime($path));
$this->context->transport->filePath = $path;
}