Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML image src case sensitivity

I have image folder names in caps. But the src is in lowercase, so this is not loading images.

I can't make all the image folders lowercase, so I want to change my code to take a case insensitive path.

I have a link like this:

<a href="http://www.google.com">
  <img id="productMainImage" src="images/Tulips.jpg" alt="image" escapeXml="false" class="product_main_image"/>
</a>

I want to make the image src as case insensitive; meaning I want my code to work even if src ="IMAGES/Tulips.jpg".

How to resolve this issue?

like image 815
vamsi Avatar asked Feb 11 '14 10:02

vamsi


People also ask

Is SRC in HTML case-sensitive?

HTML src urls are case sensitive.

Is IMG tag case-sensitive?

Actually only the interpretion of node names in filesystems is case insensitive on MS-Windows systems. Some other things are case sensitive. MS-Windows is not exactly consequent in this.

How do you use case-sensitive in HTML?

Generally, HTML is case-insensitive, but there are a few exceptions. Entity names (the things that follow ampersands) are case-senstive, but many browsers will accept many of them entirely in uppercase or entirely in lowercase; a few must be cased in particular ways. For example, Ç is &Ccedil; and ç is &ccedil;.

Are HTML attributes case-sensitive?

Attribute names for HTML elements must exactly match the names of the attributes given in the HTML elements section of this document; that is, attribute names are case-sensitive.


1 Answers

Either you can use JS to do this using toLowerCase(), or you need to rename them by yourself.

Also, it depends on the server, and HTML has nothing to do with this, UNIX Servers are case sensitive, whereas Microsoft servers are case insensitive.

Also if you are using any server side language, like PHP, you can use strtolower() as well which would be even better, as client can have JavaScript turned off in which, your page will fail to render images.

like image 193
Mr. Alien Avatar answered Oct 19 '22 02:10

Mr. Alien