Woodburn2006 Posted April 9, 2009 Share Posted April 9, 2009 i use this code to resize images that i upload for my website $save = 'thumbs/rocks1121.jpg'; $file = 'rocks.jpeg'; $size = 0.45; header('Content-type: image/jpeg'); list($width, $height) = getimagesize($file); $modwidth = $width * $size; $modheight = $height * $size; $tn= imagecreatetruecolor($modwidth, $modheight); $source = imagecreatefromjpeg($file); imagecopyresized($tn, $source, 0, 0, 0, 0, $modwidth, $modheight, $width, $height); imagejpeg($tn, $save, 100) ; it works well enough but it is only good if the images are of the same size and the same orientation. what i want to be able to do is have all of my thumbs the same size even if the original pic is a different size. so for example, if the img it is linking to portrait i still want the thumb to be 100x30 pixels but not a stretched version of the image. so basically i want it to take a 100x30 portion of the original and use that as the thumbnail. is there a way of doing this? thanks Quote Link to comment https://forums.phpfreaks.com/topic/153321-image-resizing/ 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.