sseeley Posted August 17, 2009 Share Posted August 17, 2009 Hi I have reduced the size of a photo with the following code <?php // The file $filename = 'temp.jpg'; $percent = 0.07; // Content type header('Content-type: image/jpeg'); // Get new dimensions list($width, $height) = getimagesize($filename); $new_width = $width * $percent; $new_height = $height * $percent; // Resample $image_p = imagecreatetruecolor($new_width, $new_height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // Output imagejpeg($image_p, null, 100); ?> I now want to save this new image to a new location, can anyone help me? Many thanks in advance. Stuart Quote Link to comment https://forums.phpfreaks.com/topic/170734-save-reduced-photo/ Share on other sites More sharing options...
Adam Posted August 17, 2009 Share Posted August 17, 2009 Read up on imagejpeg Quote Link to comment https://forums.phpfreaks.com/topic/170734-save-reduced-photo/#findComment-900453 Share on other sites More sharing options...
sseeley Posted August 18, 2009 Author Share Posted August 18, 2009 Thanks for your help. Stuart Quote Link to comment https://forums.phpfreaks.com/topic/170734-save-reduced-photo/#findComment-900817 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.