1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| $newwidth = 460;
$newheight = 275;
$newwidth1 = 146;
$newheight2 = 88;
if ($path !== null && $extens !== null && $ok == 1) {
$path = $path;
$pathFile = 'path';
if ($extens == 'JPEG' || $extens == 'JPG' || $extens == 'jpg') {
list($width, $height) = getimagesize($path);
$src = imagecreatefromjpeg($path);
$temp = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($temp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagejpeg($temp, $path, 100);
imagedestroy($temp);
$temp2 = imagecreatetruecolor($newwidth1, $newheight2);
imagecopyresampled($temp2, $src, 0, 0, 0, 0, $newwidth1, $newheight2, $width, $height);
imagejpeg($temp2, $pathFile, 100);
imagedestroy($temp2);
imagedestroy($src);
} |
Partager