brown2005 Posted November 21, 2006 Share Posted November 21, 2006 Hi,When uploading an image can I automatically change peoples images to width='150' height='150' and how can I do this?And is there any downfalls to doing this? Quote Link to comment https://forums.phpfreaks.com/topic/27970-image-upload/ Share on other sites More sharing options...
ToonMariner Posted November 21, 2006 Share Posted November 21, 2006 there are indeed downfalls... what if the original is not a square image?you will need to look at the image_create_from_gif/jpeg etc etc functions.pretty straight forward.I have an upload class that can handle such resizing of images etc. with the bility to take non- square images for re-sizing too (this could be adapted if you were of the inclination!)my email is available on the left there (mainly use my hotmail acc.) Quote Link to comment https://forums.phpfreaks.com/topic/27970-image-upload/#findComment-127944 Share on other sites More sharing options...
Miichael Posted November 21, 2006 Share Posted November 21, 2006 Yes there is. Unfortunately I am at work at the moment and cannot quote from memory.Look at the php reference document and read up on the image processing functions. You will find what you are looking for.It can be confusing and if you want some examples I have a number of working scripts that I would be happy to share. One I have takes an uploaded image and automatically creates a thumbnail size version which more or less sounds what you are looking for.Get back to me if you would like to see the script.Michael Quote Link to comment https://forums.phpfreaks.com/topic/27970-image-upload/#findComment-127948 Share on other sites More sharing options...
taith Posted November 21, 2006 Share Posted November 21, 2006 one bonus about html <img>... if you set width, the height scales itself down, and vice versa... so if you take a picture thats 100x200 and set[code]<img width="50">[/code]the height wil scale down to 100 Quote Link to comment https://forums.phpfreaks.com/topic/27970-image-upload/#findComment-127951 Share on other sites More sharing options...
ToonMariner Posted November 21, 2006 Share Posted November 21, 2006 But that can make the image pixelate or distort - which is awful. Setting the attributes has always been a way to control the size of the image but if you want quality with it then you shoudl adopt a more robust strategy - like properly re-creating the images. Quote Link to comment https://forums.phpfreaks.com/topic/27970-image-upload/#findComment-127978 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.