Rochtus Posted June 21, 2009 Share Posted June 21, 2009 Dear, I use a script that resizes a image to the heigth and width i want, But i want to save it with those new Sizes.. How is this possible? I use this script: <?php $filename = "../../images/SP_A0002.jpg"; // Set a maximum height and width $width = 200; $height = 200; // Content type header('Content-type: image/jpeg'); // Get new dimensions list($width_orig, $height_orig) = getimagesize($filename); $ratio_orig = $width_orig/$height_orig; if ($width/$height > $ratio_orig) { $width = $height*$ratio_orig; } else { $height = $width/$ratio_orig; } // Resample $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); // Output imagejpeg($image_p, null, 100); ?> Link to comment https://forums.phpfreaks.com/topic/163133-image-saver-resizer/ Share on other sites More sharing options...
pkedpker Posted June 21, 2009 Share Posted June 21, 2009 bool imagejpeg ( resource $image [, string $filename [, int $quality ]] ) http://us3.php.net/imageJPEG filename is optional so ughh.. imagejpeg($im, 'image.jpg'); saves it. Link to comment https://forums.phpfreaks.com/topic/163133-image-saver-resizer/#findComment-860867 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.