chadconger Posted July 25, 2006 Share Posted July 25, 2006 I have a script that will resize an image and print it. Here http://www.spurtstudios.com/test5.phpHow do I save that image to another directory such as 'images/thumbs/' ?Here is the code for the resize[code=php:0]<?php// The file$filename = 'test.jpg';// Set a maximum height and width$width = 200;$height = 200;// Content typeheader('Content-type: image/jpeg');// Get new dimensionslist($widthOrig, $heightOrig) = getimagesize($filename);if ($widthOrig < $heightOrig) { $width = ($height / $heightOrig) * $widthOrig;} else { $height = ($width / $widthOrig) * $heightOrig;}// Resample$image_p = imagecreatetruecolor($width, $height);$image = imagecreatefromjpeg($filename);imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig);// Outputimagejpeg($image_p, null, 100);?> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/15636-saving-an-image/ Share on other sites More sharing options...
ryanlwh Posted July 25, 2006 Share Posted July 25, 2006 [code]imagejpeg($image_p, 'images/thumbs/this.jpg', 100);[/code] Quote Link to comment https://forums.phpfreaks.com/topic/15636-saving-an-image/#findComment-63734 Share on other sites More sharing options...
chadconger Posted July 26, 2006 Author Share Posted July 26, 2006 Thanks for your help!! Quote Link to comment https://forums.phpfreaks.com/topic/15636-saving-an-image/#findComment-63742 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.