Fix: jpeg works like jpg
This commit is contained in:
parent
a7a55645d8
commit
763eb8f32c
@ -397,7 +397,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
|
|||||||
break;
|
break;
|
||||||
case IMAGETYPE_JPEG: // 2
|
case IMAGETYPE_JPEG: // 2
|
||||||
$img = imagecreatefromjpeg($fichier);
|
$img = imagecreatefromjpeg($fichier);
|
||||||
$extImg = '.jpg'; // Extension de l'image
|
$extImg = (preg_match('/\.jpeg$/',$file)?'.jpeg':'.jpg'); // Extension de l'image
|
||||||
break;
|
break;
|
||||||
case IMAGETYPE_PNG: // 3
|
case IMAGETYPE_PNG: // 3
|
||||||
$img = imagecreatefrompng($fichier);
|
$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
|
$imgWhFact = $imgWidth/$imgHeight; // Facteur largeur/hauteur de l'original
|
||||||
|
|
||||||
// Fixe les dimensions de la vignette
|
// Fixe les dimensions de la vignette
|
||||||
if($whFact < $imgWhFact){
|
if($whFact < $imgWhFact)
|
||||||
|
{
|
||||||
// Si largeur determinante
|
// Si largeur determinante
|
||||||
$thumbWidth = $maxWidth;
|
$thumbWidth = $maxWidth;
|
||||||
$thumbHeight = $thumbWidth / $imgWhFact;
|
$thumbHeight = $thumbWidth / $imgWhFact;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Si hauteur determinante
|
// Si hauteur determinante
|
||||||
$thumbHeight = $maxHeight;
|
$thumbHeight = $maxHeight;
|
||||||
$thumbWidth = $thumbHeight * $imgWhFact;
|
$thumbWidth = $thumbHeight * $imgWhFact;
|
||||||
@ -475,7 +478,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
|
|||||||
break;
|
break;
|
||||||
case IMAGETYPE_JPEG: // 2
|
case IMAGETYPE_JPEG: // 2
|
||||||
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
|
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
|
||||||
$extImgTarget = '.jpg';
|
$extImgTarget = (preg_match('/\.jpeg$/',$file)?'.jpeg':'.jpg');
|
||||||
$newquality=$quality;
|
$newquality=$quality;
|
||||||
break;
|
break;
|
||||||
case IMAGETYPE_PNG: // 3
|
case IMAGETYPE_PNG: // 3
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user