From 763eb8f32c43164d505e322ed561e9ef89733251 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Mar 2012 01:21:18 +0100 Subject: [PATCH] Fix: jpeg works like jpg --- htdocs/core/lib/images.lib.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index dd790a9ca3e..0a251030204 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -397,7 +397,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $ break; case IMAGETYPE_JPEG: // 2 $img = imagecreatefromjpeg($fichier); - $extImg = '.jpg'; // Extension de l'image + $extImg = (preg_match('/\.jpeg$/',$file)?'.jpeg':'.jpg'); // Extension de l'image break; case IMAGETYPE_PNG: // 3 $img = imagecreatefrompng($fichier); @@ -426,11 +426,14 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $ $imgWhFact = $imgWidth/$imgHeight; // Facteur largeur/hauteur de l'original // Fixe les dimensions de la vignette - if($whFact < $imgWhFact){ + if($whFact < $imgWhFact) + { // Si largeur determinante $thumbWidth = $maxWidth; $thumbHeight = $thumbWidth / $imgWhFact; - } else { + } + else + { // Si hauteur determinante $thumbHeight = $maxHeight; $thumbWidth = $thumbHeight * $imgWhFact; @@ -475,7 +478,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $ break; case IMAGETYPE_JPEG: // 2 $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0); - $extImgTarget = '.jpg'; + $extImgTarget = (preg_match('/\.jpeg$/',$file)?'.jpeg':'.jpg'); $newquality=$quality; break; case IMAGETYPE_PNG: // 3