|
Posted by Michael Fesser on 11/14/07 17:37
..oO(Darko)
>On Nov 12, 12:11 am, Voodoo Jai <voodoo...@btinternet.com> wrote:
>>[...]
>> list($width, $height, $type) = getimagesize($FileName);
>> ?>
>> <div style="overflow: auto; width: 610px; height: 600px">
>> <img src="FileName" width="<?PHP $width ?>" height="<?PHP $height ?>">
>>
>> </div>
>> </td>
>
>Why would you need "width='$width' height='$height'" at all, if $width
>and $height
>are image dimensions. You only do that when you need to display it
>resized.
There's another reason, given in the HTML spec:
| The height and width attributes give user agents an idea of the size
| of an image or object so that they may reserve space for it and
| continue rendering the document while waiting for the image data.
This prevents the surrounding content from jumping around when the image
appears.
>Anyway,
>it's a bad (and deprecated) practice to use HTML tags to define
>element's style, e.g.
>image size. Use CSS rules instead.
Correct, but IMHO this case is an exception. For images and some other
elements the 'width' and 'height' attributes are not deprecated for good
reasons.
Micha
[Back to original message]
|