1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| copy($dest_fichier.$fichier, $dest_thumbs.$thumbs);
$dst_w='95';
$dst_h='60';
// Lit les dimensions de l'image
$size = GetImageSize('C:\EasyPHP 2.0b1\www\latentedanslesetoiles/images/thumbs/gallery1/'.$thumbs);
$src_w = $size[0];
$src_h = $size[1];
// Teste les dimensions tenant dans la zone
$test_h = round(($dst_w / $src_w) * $src_h);
$test_w = round(($dst_h / $src_h) * $src_w);
// Si Height final non précisé (0)
if(!$dst_h) $dst_h = $test_h;
// Sinon si Width final non précisé (0)
elseif(!$dst_w) $dst_w = $test_w;
// Sinon teste quel redimensionnement tient dans la zone
elseif($test_h>$dst_h) $dst_w = $test_w;
else $dst_h = $test_h;
$newimg = imagecreatetruecolor($test_w,$test_h);
$img = imagecreatefromjpeg('C:\EasyPHP 2.0b1\www\latentedanslesetoiles/images/thumbs/gallery1/'.$thumbs);
imagecopyresampled($newimg, $img, 0, 0, 0, 0, $test_w, $test_h,$src_w,$src_h);
imagejpeg($newimg,"C:\EasyPHP 2.0b1\www\latentedanslesetoiles/images/thumbs/gallery1/",777);
//imagedestroy($thumbs);
//echo substr(sprintf('%o', fileperms('/etc/passwd')), -4);
echo "WIDTH=".$thumbs." HEIGHT=".$test_h; |
Partager