Originally Posted by ksreeniv
I have a php page wherein it retrieves images of different sizes. I need to display all the images in a uniform format. I tried altering the size of the image by altering the width and height attributes but I am getting distorted images.
From your comment that if you set both height and width the images distort, I take it that the images have different aspect ratios. If that is the case then it will be impossible to get a completely uniform format (ie same size and width) without at least one compromise.
The simplest solutions to implement are to use a uniform width or a uniform height. That is set some thing like
but not both.
This will have all your images resized by the browser to be the same height or width with the other dimension being altered by the browser so that the image maintains its aspect ratio.
If you want images that are the same size (both width and height) you will need to in some way crop the images, which can be problematic when done automatically as the important part of the image will sometimes be in the area that gets cropped.
- Michael Baker - HTML Tags Guide
- Reference and Tutorials
- Like voting, validate early, validate often - W3C HTML Validator
- W3C CSS Validator
- Wot? me cynical? no, its just if you vote, er, validate early, you have more chance of validating often.