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); ?> Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.