Hi, I need to resize images when the user uploads and create a new image (thumbnail), but I dont want it to look all distorted, is there a way in php to resize images without losing the quality of the image. Thanks in advance Simon
Hi Simon. Please check imagecopyresampled PHP function. You can find some imagecopyresampled thumbnail creation examples at PHP website.
Yes. The GD library is good for resizing images. As long as you shrink them, there's no real loss of quality. It just doesn't work well when you try to make them bigger... =) The relevant functions you'll be looking at are imagecreatefrom*, getimagesize, imagecreatetruecolor, imagecopyresampled, and image* - where * is the proper extension (i.e. png, jpeg, gif). Try reading through the relevant chapter of Practical PHP Programming on working with images. It's got some good examples for creating/resizing an image. If you look through the PHP Tutorials in my sig, there's also an old tutorial on resizing images that might be useful. Good luck, - Walkere