EnglishHow do you get the personal thumbnails (added in 2.3.g) to work? I am trying to get higher resolution thumbnails for videos. I have placed high resolution images with the GT- prefix (GT-name.jpg) in the thumbnail directory and even tried clearing the gthumb+ cache and it continues to show the low resolution thumbnail (thumb_name.jpg).
Thanks.
Offline
I believe I have discovered the problem. In the get_gthumb_data function in the main.inc.php file, you are testing to see if it is an image. If not, you are returning the thumbnail before your code further down has a chance to check for a GT- image file.
It seems to work by moving the GT section above the part that checks to see if it is an image or not.
current code (lines 135-180 of main.inc.php):
function get_gthumb_data($picture, $size='small')
{
global $conf;
$picture_ext = array('jpg', 'jpeg', 'png', 'gif');
if (!in_array(strtolower(get_extension($picture['path'])), $picture_ext))
{
list($width, $height) = getimagesize(get_thumbnail_path($picture));
return array(
'src' => get_thumbnail_url($picture),
'width' => $width,
'height' => $height,
);
}
$new_height = $size == 'small' ? $conf['GThumb']['height'] : $conf['GThumb']['height'] * 2 + $conf['GThumb']['margin'];
$file = GTHUMB_CACHE_DIR.'/'.$new_height.'/'.md5($picture['path'].(!empty($picture['md5sum']) ? $picture['md5sum'] : '')).'.'.$picture['tn_ext'];
if (file_exists($file))
{
list($width, $height) = getimagesize($file);
return array(
'src' => embellish_url(get_root_url().$file),
'width' => $width,
'height' => $height,
);
}
if ( !empty($picture['tn_ext']) )
{
$file = substr_replace(get_filename_wo_extension($picture['path']), '/thumbnail/GT-',strrpos($picture['path'],'/'),1).'.'.$picture['tn_ext'];
if (file_exists($file))
{
list($width, $height) = getimagesize($file);
return array(
'src' => embellish_url(get_root_url().$file),
'width' => $width,
'height' => $height,
);
}
}new code:
function get_gthumb_data($picture, $size='small')
{
global $conf;
$picture_ext = array('jpg', 'jpeg', 'png', 'gif');
if ( !empty($picture['tn_ext']) )
{
$file = substr_replace(get_filename_wo_extension($picture['path']), '/thumbnail/GT-',strrpos($picture['path'],'/'),1).'.'.$picture['tn_ext'];
if (file_exists($file))
{
list($width, $height) = getimagesize($file);
return array(
'src' => embellish_url(get_root_url().$file),
'width' => $width,
'height' => $height,
);
}
}
if (!in_array(strtolower(get_extension($picture['path'])), $picture_ext))
{
list($width, $height) = getimagesize(get_thumbnail_path($picture));
return array(
'src' => get_thumbnail_url($picture),
'width' => $width,
'height' => $height,
);
}
$new_height = $size == 'small' ? $conf['GThumb']['height'] : $conf['GThumb']['height'] * 2 + $conf['GThumb']['margin'];
$file = GTHUMB_CACHE_DIR.'/'.$new_height.'/'.md5($picture['path'].(!empty($picture['md5sum']) ? $picture['md5sum'] : '')).'.'.$picture['tn_ext'];
if (file_exists($file))
{
list($width, $height) = getimagesize($file);
return array(
'src' => embellish_url(get_root_url().$file),
'width' => $width,
'height' => $height,
);
}Thanks
Offline