1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-29 09:44:28 +01:00

Thumbnail the first frame only.

This commit is contained in:
Michael Save 2012-03-17 11:55:16 +11:00
parent fc9407e1b3
commit e3e942a1c6

View File

@ -13,8 +13,10 @@
$this->src = $src;
$this->format = $format;
if($config['imagick']) {
$classname = $config['imagick_convert'] ? 'ImageConvert' : 'ImageImagick';
if($config['thumb_method'] == 'imagick') {
$classname = 'ImageImagick';
} elseif($config['thumb_method'] == 'convert') {
$classname = 'ImageConvert';
} else {
$classname = 'Image' . strtoupper($this->format);
if(!class_exists($classname)) {
@ -38,8 +40,10 @@
public function resize($extension, $max_width, $max_height) {
global $config;
if($config['imagick']) {
$classname = $config['imagick_convert'] ? 'ImageConvert' : 'ImageImagick';
if($config['thumb_method'] == 'imagick') {
$classname = 'ImageImagick';
} elseif($config['thumb_method'] == 'convert') {
$classname = 'ImageConvert';
} else {
$classname = 'Image' . strtoupper($extension);
if(!class_exists($classname)) {
@ -242,7 +246,7 @@
$quality = $config['thumb_quality'] * 10;
if(shell_exec("convert -flatten -filter Point -resize {$this->width}x{$this->height} -quality {$quality} " . escapeshellarg($this->src) . " " . escapeshellarg($this->temp)))
if(shell_exec("convert -flatten -filter Point -resize {$this->width}x{$this->height} -quality {$quality} " . escapeshellarg($this->src . '[0]') . " " . escapeshellarg($this->temp)))
error('Failed to resize image!');
}
}