garydt Posted July 24, 2007 Share Posted July 24, 2007 I've got an image resize script that resizes uploaded images but i want it to be saved under a different name. How do i do that? function resizeimage($name){ $filename = './uploads/'.$name; if(file_exists($filename)) { $image = imagecreatefromjpeg($filename); //unresized image $im_info = getimagesize($filename); //unresized image $im_width = $im_info[0]; $im_height = $im_info[1]; $im_flag = $im_info[2]; if($im_width >= $im_height) { $im_divice = $im_width / 140; }else { $im_divice = $im_height / 140; } $thumb_width = $im_width / $im_divice; $thumb_height = $im_height / $im_divice; //create empty image $thumb = imagecreatetruecolor($thumb_width, $thumb_height); //resize image imagecopyresampled($thumb, $image, 0, 0, 0, 0, $thumb_width, $thumb_height, $im_width, $im_height); if(imagejpeg($thumb, "thumbnails/".$name, 80)) { //image-resource, filename, quality return 1; } 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.