kredd Posted May 28, 2007 Share Posted May 28, 2007 got a two-parter... 1. any reason why the code below would create a thumbnail but then not have a browser recognize it? the browser displays the original it was copied from and photoshop and fireworks both recognize it. 2. if i imagecopyresampled a 2400x3000 jpg down to a 100 px thumb, it looks like the thumb was cropped and resized inside the orig photo size...so it's a 100px thumb inside a 2400x3000px black box - and if i use imagecopyresized i just get a 2400x3000px black box. if ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$file_dest))) { $newname = '/my/server/path to/images/gallery/' . $dest_fldr . '_tmb/' . $filename_tmb; // file path on server for tmb copy($file_dest, $newname); $thumbWidth = 100; // set witdth of thumbnails header('Content-type: image/jpeg'); $new_img = imageCreateFromJPEG($newname); $width = imagesx($new_img); $height = imagesy($new_img); $new_width = 100; // width of thumbnail $new_height = floor( $height * ( $thumbWidth / $width ) ); // height of thumbnail $tmp_img = imagecreatetruecolor( $width, $height ); // temp big image imagecopyresampled( $tmp_img, $new_img, 0, 0, 0, 0, $new_width, $new_height, $width, $height ); // create big // save the new images to their folders imagejpeg( $tmp_img, $newname,50 ); imageDestroy($tmp_img); imageDestroy($new_img); any ideas?? thanks! Quote Link to comment https://forums.phpfreaks.com/topic/53312-imagecopyresampled-doing-weird-things/ Share on other sites More sharing options...
Barand Posted May 28, 2007 Share Posted May 28, 2007 IF tmp_image is the thumbnail, make it thumnail size $tmp_img = imagecreatetruecolor( $new_width, $new_height ); // temp thumb image Quote Link to comment https://forums.phpfreaks.com/topic/53312-imagecopyresampled-doing-weird-things/#findComment-263490 Share on other sites More sharing options...
kredd Posted May 28, 2007 Author Share Posted May 28, 2007 ahh, thanks man...couldn't see the forest for the trees!! Quote Link to comment https://forums.phpfreaks.com/topic/53312-imagecopyresampled-doing-weird-things/#findComment-263515 Share on other sites More sharing options...
kredd Posted May 28, 2007 Author Share Posted May 28, 2007 but does anyone know why it won't display in a browser? Quote Link to comment https://forums.phpfreaks.com/topic/53312-imagecopyresampled-doing-weird-things/#findComment-263516 Share on other sites More sharing options...
Barand Posted May 28, 2007 Share Posted May 28, 2007 Because it's being sent to a file Quote Link to comment https://forums.phpfreaks.com/topic/53312-imagecopyresampled-doing-weird-things/#findComment-263517 Share on other sites More sharing options...
kredd Posted May 29, 2007 Author Share Posted May 29, 2007 not sure i understand your reply....yes, it's being sent to a file, a .jpg file, right?? when i type in the url to that .jpg i get a 'page not found' error. it doesn't show up in my gallery either. but i can download it and open it up in photoshop and fireworks just fine. Quote Link to comment https://forums.phpfreaks.com/topic/53312-imagecopyresampled-doing-weird-things/#findComment-263681 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.