Is there a standard for handling missing images' space?

Please support our Site Layout and Usability advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Jan 2009
Posts: 7
Reputation: Vesperto is an unknown quantity at this point 
Solved Threads: 0
Vesperto's Avatar
Vesperto Vesperto is offline Offline
Newbie Poster

Is there a standard for handling missing images' space?

 
0
  #1
Feb 17th, 2009
I'm testing a small site in multiple browsers and am getting different results with this code:

  1. <img src="...path.." alt="text if image is missing" height="128" width="128" />

If the image is missing:
- Opera 10.0 (Presto) and Midori 0.1.2 (Webkit) will display the text within a 128x128 space;
- Firefox/Iceweasel 3.0.5 (Gecko) and KAzehakase 0.5.4 (libxul-1.9.0.5?) will display just the text, without filling a 128x128 space.

I could put the dimensions in CSS, but then i'd have to do that for every image i'd use... not practical.

Any suggestions? Any good resources for this type of problem?
Nuno Magalhães
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,373
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 166
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: Is there a standard for handling missing images' space?

 
0
  #2
Feb 17th, 2009
many browsers discard measurements without a unit

<img src="...path.." alt="text if image is missing" height="128px" width="128px" />
Last edited by almostbob; Feb 17th, 2009 at 10:45 am.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 7
Reputation: Vesperto is an unknown quantity at this point 
Solved Threads: 0
Vesperto's Avatar
Vesperto Vesperto is offline Offline
Newbie Poster

Re: Is there a standard for handling missing images' space?

 
0
  #3
Feb 17th, 2009
Thanks, but it didn't change behaviour in any of the browsers i listed. Also, i thought units were only valid for CSS, not HTML-tags?

I want to determine the dimensions of the pictures for when, for some reason, the file is missing; and for accessibility. I'd also need to automate the code but i'll pester the PHP-forum for that (or maybe use a templating engine?).

The main reason is for the pages to load correctly, without needing to resize once the images are downloaded by the UA. I'm using XHTML 1.0 Strict; going Transitional is not an option.
Nuno Magalhães
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,373
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 166
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: Is there a standard for handling missing images' space?

 
0
  #4
Feb 17th, 2009
Your right, its me reading the w3 page, height='pixels' thinking it meant you had to put the dim in
pixel is the default
do the browsers work with inline styles < style="height:128px;width:128px" >
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 7
Reputation: Vesperto is an unknown quantity at this point 
Solved Threads: 0
Vesperto's Avatar
Vesperto Vesperto is offline Offline
Newbie Poster

Re: Is there a standard for handling missing images' space?

 
0
  #5
Feb 17th, 2009
I had tried inline styles before, but revamped my testing. I'd note both images i'm testing are within <a> tags but i also tried using the images isolated. Here's my new code:

  1. <img src="filename" alt="some text" style="height:128px; width:128px; background-color: #FFFFFF;" />

All that changes is the white background, all browsers still don't/render the size. This whole image-size-while-loading issue isn't new, i thought i was making some silly mistake and that there's a Right Way™ to do this...

I've uploaded the site here: http://www.dei.isep.ipp.pt/~i000283/test/

As a remark, both Opera and Midori are the only ones that actually reserve the space for the images according to specified height/width and they are also the only browsers from the ones i listed that actually score 100/100 on the Acid3 test. So maybe it's a rendering/lack of standard issue?
Last edited by Vesperto; Feb 17th, 2009 at 3:14 pm.
Nuno Magalhães
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 3,210
Reputation: MidiMagic has a spectacular aura about MidiMagic has a spectacular aura about 
Solved Threads: 164
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Nearly a Senior Poster

Re: Is there a standard for handling missing images' space?

 
0
  #6
Feb 17th, 2009
Height and width parameters are deprecated.

When you don't yet have the image, use a blank image the same size. Put some text on it, like "Bob lost the picture."

Many browsers refuse to render space for objects they can't find.
Last edited by MidiMagic; Feb 17th, 2009 at 8:44 pm.
Daylight-saving time uses more gasoline
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 7
Reputation: Vesperto is an unknown quantity at this point 
Solved Threads: 0
Vesperto's Avatar
Vesperto Vesperto is offline Offline
Newbie Poster

Re: Is there a standard for handling missing images' space?

 
0
  #7
Feb 18th, 2009
Originally Posted by MidiMagic View Post
Height and width parameters are deprecated.

When you don't yet have the image, use a blank image the same size. Put some text on it, like "Bob lost the picture."

Many browsers refuse to render space for objects they can't find.
I know it's preferred to use CSS instead, which is what i do. Using a blank image implies having at least one extra image per image size on the server, sounds cumbersome to me. I'll stick with jumpy loading for now, but thanks for the tips.
Nuno Magalhães
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Site Layout and Usability Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC