sooty2006 Posted July 17, 2007 Share Posted July 17, 2007 i have my own website and each user has there own profile but some images are too big then create a mess by moving items to create space .i want to know how to shrink there images so they fit in a certain space could someone please help me on this an also tell me where in the php script i need to put iti think this might be in the wrong forum cos i think i need java to do it thanks Scott Link to comment Share on other sites More sharing options...
Skemcin Posted July 17, 2007 Share Posted July 17, 2007 well, there are four techniques to use:a.) use HTML to hard code the width and height of all images - thus requiring all users to upload the profile image of the same width and height.b.) use php (in this case since you indicate its use) to determine if the image width and height exceeds your requirements and if so, use hard coded width and height values - ignoring the actual - otherwise use the actual wdith and heightc.) check the file when uploaded to prevent it from being to large based on your requirementd.) automatically resize uploaded images if they exceed your requirements Link to comment Share on other sites More sharing options...
sooty2006 Posted July 17, 2007 Author Share Posted July 17, 2007 well, there are four techniques to use:a.) use HTML to hard code the width and height of all images - thus requiring all users to upload the profile image of the same width and height.b.) use php (in this case since you indicate its use) to determine if the image width and height exceeds your requirements and if so, use hard coded width and height values - ignoring the actual - otherwise use the actual wdith and heightc.) check the file when uploaded to prevent it from being to large based on your requirementd.) automatically resize uploaded images if they exceed your requirementsok how would i do it on php because the users dont upload pics to the site they just put in the img url? Link to comment Share on other sites More sharing options...
justsomeguy Posted July 17, 2007 Share Posted July 17, 2007 You can use this function to get the size of an image:http://www.php.net/manual/en/function.getimagesize.phpYou can use this function to create a resized image:http://www.php.net/manual/en/function.imagecopyresampled.phpCheck the examples to see how they're used. I'm not sure if you can use getimagesize with a URL or if the image has to be a local file. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.