Reply to Re: getimagesize function and using variables to display an image

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация