I have one site with two languages: English and Spanish for example. What would be the proper convention to name image files?

From my point of view it would be stupid to duplicate image and then name it according to on which site it will be uploaded. It would be waste of resources IMO and unnecessary job to do.

What do you think about this one?

  • So all the images for both languages would be exactly the same, there is no text in the image and the context is exactly the same? They do not need to be resized or tweaked in any way?
    – MrWhite
    Sep 25, 2012 at 23:16

4 Answers 4


If duplicating the image really is unnecessary then you could still perhaps have the best of both worlds... only store the image once, but have it referenced by different filenames, for the different languages - using mod_rewrite (Apache) and an internal rewrite.

Based on unor's example:

  • example.net/img/en/house.png
  • example.net/img/es/casa.png

These would be internally rewritten to send a request to your server-side script:

  • imgScript.php?file=en/house.png
  • imgScript.php?file=es/casa.png

Your script knows to serve the same image for both requested files, perhaps with a simple lookup associative array:

array (
  'en/house.png' => 'real/path/to/my-house-pic.png',
  'es/casa.png' => 'real/path/to/my-house-pic.png',
  // etc.

This method allows you to serve different images for certain files if you wished.

  • 1
    You could also use symlinks I guess.
    – Andy
    Sep 26, 2012 at 8:26

Two solutions which don't require filename changing but give a different file path:

  1. Create different domains which forward to the same directory, where the site then detects language and servers correct paths/site content. e.g. website.es would pull content from website.com so website.com/picture.jpg becomes website.es/picture.jpg

  2. Similarly use subdomains on the 'main' (for me this is the first site and usually language of site owner/main admin) site such as es.website.com and dk.website.com (this is cheaper too :)) and use the same approach as above pulling site from one directory and getting language specific URLs like es.website.com/picture.jpg

What both of these solutions don't offer is a meaningful file name like previous answerer noted table.jpg or mensa.jpg

However, using meta info like alt and title tags, not to mention surrounding content and language declaration of the page the file is on will compensate. Also with both of the above solutions you can set the geolocation of the site url (and content) in Google Webmaster Tools.

This sounds like a lot of work but if you use a popular CMS there are plugins for it.


Well, there are 4 ways if you don't want to duplicate your images:

  • in English (house.png)
  • in Spanish (casa.png)
  • in English and Spanish (house_casa.png or casa_house.png)
  • no linguistic content: (alpha-)numerical ID, date (2012-09-25.png, 123.png, …)

But I would duplicate them. Images are content like text, PDF, videos, audio, …, too. So in general you probably have (or need) an infrastructure that allows you to provide translated media files. Of course there are media files that don't need any translation (silent films, photographs without textual information etc.), but I like to think of them as exceptions (doesn't matter if they really are).

So I'd go with (even if the images would be the same):

  • example.net/en/house.png
  • example.net/es/casa.png
  • 3
    Just wondering... If images are content (which they are), then if you duplicate images, but with different names, is this not duplicate content? Maybe not, since the filename could also be perceived as part of the content - but then again, the URL is not usually seen as part of the content?
    – MrWhite
    Sep 26, 2012 at 8:23
  • @w3d: I think this is no problem, because it is widely used. AFAIK CDNs have dozens of different URLs for the same image. Also something like an avatar or a profile photo might be uploaded to several different social networks (resulting in the same photo having several URLs)
    – unor
    Sep 27, 2012 at 4:17

If the concern is SEO, according to Google, image name and path is a very small ranking factor, and they would see all other images as duplicate and hold only one url. Then, it is practically better to use only one image name and path in main language for all the language page versions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.