Fix thumbs are using same extension than original.

This commit is contained in:
Laurent Destailleur 2016-08-05 04:31:19 +02:00
parent 1b10e27618
commit e1e8254bcf
2 changed files with 3 additions and 5 deletions

View File

@ -860,10 +860,8 @@ class FormFile
print '<td align="center">';
if (image_format_supported($file['name']) > 0)
{
$minifile=getImageFileNameForSize($file['name'], '_mini', '.png'); // Thumbs are created with filename in lower case and with .png extension
//print $relativepath.'<br>';
//print $file['path'].'/'.$minifile.'<br>';
if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.'.$fileinfo['extension']); // For old thumbs
$minifile=getImageFileNameForSize($file['name'], '_mini'); // For new thumbs using same ext (in lower case howerver) than original
if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension
//print $file['path'].'/'.$minifile.'<br>';
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" class="aphoto" target="_blank">';
print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$minifile).'" title="">';

View File

@ -3676,7 +3676,7 @@ class Product extends CommonObject
if ($size == 1 || $size == 'small') { // Format vignette
// Find name of thumb file
$photo_vignette=basename(getImageFileNameForSize($dir.$file, '_small', '.png'));
$photo_vignette=basename(getImageFileNameForSize($dir.$file, '_small'));
if (! dol_is_file($dirthumb.$photo_vignette)) $photo_vignette='';
// Get filesize of original file