View Full Version : uploading image distorting problem!

03-07-2007, 04:28 PM

I have developed a cms for a car dealership which allows the dealer to upload images into it.

I am having problems in that whn the images are uploaded and resized they are distorting quiet badly.

The original images are taken with a good quality didgital camera at 1280 x 960 pixels and whenever they are displayed on the site as a smaller image the proportions are kept the same ie 235 x 176 and 300 x 225.

i have not set anything to alter the quality and was wonderign if this might help with the distortion if i reduced this.

you can see the images in teh cms here


any ideas on how to solve this problem would be very much appreciated

many thanks

03-07-2007, 04:53 PM
Looks like you're forcing the browser to change the size (<img height = "y" width="x" />).

Browsers are notorious for hacking images when they resize. If possible, modify you're upload script to use gdlib or similar and resize the images on the server to the right size. This should produce images that are the proper size and don't need the browser to handle resizing.

03-07-2007, 05:00 PM
Are you using imagecopyresampled() (http://www.php.net/imagecopyresampled)?

03-07-2007, 05:13 PM
no not using it - do you suggest using it?


03-07-2007, 05:47 PM
If you are simply using the "height" and "width" attributes of image (which I believe to be deprecated) then you are not actually resizing your pictures. You are simply showing a a smaller version of that picture without resampling it. You would definately benefit from using the GDLib or ImageMagick to resize your pictures. If you are unfamiliar you can always use a thumbnail class.
Thumbnail scripts (http://www.google.com/search?source=ig&hl=en&q=thumbnail+class+php)

03-07-2007, 05:59 PM
no not using it - do you suggest using it?

Yes. When you upload the images generate a thumbnail at the same time.

03-08-2007, 09:01 AM
ok thanks for the advice - i'll give it a try