Display of image name when loading

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?

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
[email protected]

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
[email protected]

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
[email protected]

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.

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). :slight_smile: Could also be that I’m on a
slow server (site5.com)

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

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…

:slight_smile: Could also be that I’m on a
slow server (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
[email protected]