Hi,
this seems to be a problem with headers. Try this: <?php $max_width = 0; $tmp = imagecreatefromjpeg("img.jpg"); if (imagesx ($tmp) < $max_width) { imagejpeg($tmp); exit(); } $dst_img = imagecreate(80,60); imagecopyresized($dst_img,$tmp,0,0,80,60,80,60,imagesx($tmp),imagesy ($tmp)); imagejpeg($dst_img, "new_image.jpg"); ?> <img src="new_image.jpg"> Note: directory for writing new image must have chmod 777 and sticky bit (+t) permissions and may not in webroot "Brian & Shannon Windsor" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I'm trying to use imagecopyresized to generate a thumbnail image and then > store the image in the proper place, but I'm running into some problems. > > I'm using the standard code: > > $src_img = > imagecreatefromjpeg("../php/images/".$HTTP_POST_FILES['imagefile']['name']); > > if (imagesx($src_img)<$max_width){ > imagejpeg($src_img); > exit(); > } > > $dst_img = imagecreate(80,60); > imagecopyresized($dst_img,$src_img,0,0,80,60,80,60,imagesx($src_img),imagesy > ($src_img)); > imagejpeg($dst_img); > > this will give me this output: > > 3?R?rJFIF?t>CREATOR: gd-jpeg v2.0 (using IJG JPEG v62), default quality > ?UC $.' ",#(7),01444'9=82<.342?UC > 2!!22222222222222222222222222222222222222222222222222?R > > What I need is for imagecopyresized to make a new file that I can then give > a new name and copy into the files that I want it to go to, such as.. > > copy ($dst_img, "../php/thumbs/".$thumb_name); > > If I try to this, I get the following error... > > Warning: Unable to open 'Resource id #4' for reading: No such file or > directory in /u/php/uppic.php on line 55 > > > (uppic.php is the name of the .php script this is in) > > Am I missing something obvious? > > Thanks, > > Brian > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php