# Display of image name when loading

**URL:** <https://www.ruby-forum.com/t/display-of-image-name-when-loading/173847>\
**Category:** Rails\
**Created:** [August 16, 2009, 8:28pm UTC](https://www.ruby-forum.com/t/display-of-image-name-when-loading/173847 "2009-08-16T20:28:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [August 16, 2009, 8:28pm UTC](https://www.ruby-forum.com/t/display-of-image-name-when-loading/173847/1 "2009-08-16T20:28:24Z")

</div>

When the page loads I can see the image name displayed until it actually  
loads. Is that a RoR or Apache/Passenger feature? Can I disable it?

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [August 16, 2009, 9:04pm UTC](https://www.ruby-forum.com/t/display-of-image-name-when-loading/173847/2 "2009-08-16T21:04:45Z")

</div>

PÃ¥l BergstrÃ¶m wrote:

> When the page loads I can see the image name displayed until it actually  
> loads. Is that a RoR or Apache/Passenger feature?

No, that’s a browser feature. Most browsers display the alt text for  
the image (or the filename if no alt text) as the image loads.

> Can I disable it?

Sure. Just specify meaningful – or blank – alt text.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [August 17, 2009, 12:21am UTC](https://www.ruby-forum.com/t/display-of-image-name-when-loading/173847/3 "2009-08-17T00:21:38Z")

</div>

PÃ¥l BergstrÃ¶m wrote:  
[…]

> Hmm, not sure you’re right. I never see it otherwise, even on sites that  
> use the alt attribute.

Perhaps because the images load too fast to see it? Or maybe I’m wrong  
and it’s the title attribute.

> It should be that if an image doesn’t load, then  
> alt would be displayed.

Yes.

> Anyway, I never use it myself so I’m not  
> certain.

Never use what? Alt? If so, then you’re in for a lecture. Every ![]()  
tag, without exception, should have an alt attribute. It can be blank,  
but it must be there (for many good reasons). In addition, it’s  
required in order to get your HTML to validate to recent versions of the  
standard.

> In this case it comes from the image\_tag, so it’s RoR. Any way to  
> disable it?

You can specify HTML attributes on the image\_tag. Please see the docs  
for syntax.

> I never seen it on LiteSpeed Server. It came with Apache and Passenger.

Unlikely. The browser has no way of knowing whether you’re using Apache  
or LiteSpeed, and the HTML should be the same in either case.

Why don’t you inspect the HTML that Rails generates and see what’s  
different between LiteSpeed and Passenger?

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [August 16, 2009, 9:35pm UTC](https://www.ruby-forum.com/t/display-of-image-name-when-loading/173847/4 "2009-08-16T21:35:17Z")

</div>

Marnen Laibow-Koser wrote:

> PÃ¥l BergstrÃ¶m wrote:
> 
> > When the page loads I can see the image name displayed until it actually  
> > loads. Is that a RoR or Apache/Passenger feature?
> 
> No, that’s a browser feature. Most browsers display the alt text for  
> the image (or the filename if no alt text) as the image loads.
> 
> > Can I disable it?
> 
> Sure. Just specify meaningful – or blank – alt text.
> 
> ## Best,
> 
> Marnen Laibow-Koser  
> [http://www.marnen.org](http://www.marnen.org)  
> removed\_email\_address@domain.invalid

Hmm, not sure you’re right. I never see it otherwise, even on sites that  
use the alt attribute. It should be that if an image doesn’t load, then  
alt would be displayed. Anyway, I never use it myself so I’m not  
certain.

In this case it comes from the image\_tag, so it’s RoR. Any way to  
disable it?

I never seen it on LiteSpeed Server. It came with Apache and Passenger.

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [August 17, 2009, 8:01am UTC](https://www.ruby-forum.com/t/display-of-image-name-when-loading/173847/5 "2009-08-17T08:01:57Z")

</div>

Marnen Laibow-Koser wrote:

> Never use what? Alt? If so, then you’re in for a lecture. Every ![]()  
> tag, without exception, should have an alt attribute. It can be blank,  
> but it must be there (for many good reasons). In addition, it’s  
> required in order to get your HTML to validate to recent versions of the  
> standard.

I know it must be there for validation. It’s there but I don’t use it  
when coding in regular html. As I see it the alt-attribute is not that  
relevant today. Some use it for SEO but for what I know I don’t think  
it’s that important.

> You can specify HTML attributes on the image\_tag. Please see the docs  
> for syntax.

I ment on a global basis so I don’t have to edit the rails image tag.

> Unlikely. The browser has no way of knowing whether you’re using Apache  
> or LiteSpeed, and the HTML should be the same in either case.

True. My thought was that there could still be some difference in how  
the code and html is handled (guessing). 🙂 Could also be that I’m on a  
slow server ([site5.com](http://site5.com))

In any case, it looks bad when loading the page and that’s the important  
thing.

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [August 17, 2009, 5:04pm UTC](https://www.ruby-forum.com/t/display-of-image-name-when-loading/173847/6 "2009-08-17T17:04:13Z")

</div>

PÃ¥l BergstrÃ¶m wrote:  
[…]

> I know it must be there for validation. It’s there but I don’t use it  
> when coding in regular html. As I see it the alt-attribute is not that  
> relevant today. Some use it for SEO but for what I know I don’t think  
> it’s that important.

You are quite wrong. It is important for accessibility (its original  
purpose and still its most important): it allows people using screen  
readers or text browsers (such as visually impaired users) to have some  
hope of understanding your site. It is also important for search  
engines, since their crawlers tend to act like text browsers.

> > You can specify HTML attributes on the image\_tag. Please see the docs  
> > for syntax.
> 
> I ment on a global basis so I don’t have to edit the rails image tag.

I don’t recall any specific configuration options, but again, check the  
docs.

If there are none, perhaps wrap it in a helper method that does what you  
want. You _might_ even be able to use alias\_method\_chain to change the  
behavior of image\_tag.

> > Unlikely. The browser has no way of knowing whether you’re using Apache  
> > or LiteSpeed, and the HTML should be the same in either case.
> 
> True. My thought was that there could still be some difference in how  
> the code and html is handled (guessing).

Theoretically, perhaps there could be, but HTTP servers shouldn’t be  
messing with the data they serve…

> 🙂 Could also be that I’m on a  
> slow server ([site5.com](http://site5.com))

That’s possible. Have you been able to compare the HTML as I suggested?

> In any case, it looks bad when loading the page and that’s the important  
> thing.

Of course.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
