0

I have thousands of images stored on multiple folders on a Godaddy shared-hosting server. And I have a site with an image gallery pointing to this images. The problem I have is that a big bunch of images are stored with names containing special spanish characters (á, é, í, ó, ú, ñ).

The complete list of file names are stored on a MySql table, so the gallery will view the images in response to the query made on MySql. In other words, MySql says which images will open depending on the query result.

Everything works fine, except with the images stored with this special characters, they don't show up, because the browser looks for the image with some sort of encoding and will not match the real file name resulting on a broken image.

Is there a workaround for this? I mean, renaming all the images seems impossible since there are too many.

Appreciate any help.

azirion
  • 109
  • 1
  • 12

1 Answers1

0

Oh, it's a common problem, guy! I'm Brazilian and here these special characters are used all the time. So, you can "solve" this problem trying set the image by css, instead with the img tag.

for example, let's suppose that your image is called "cão.png", and it's 150x150:

<!-- in the HTML -->
<div class="img"></div>

/* in the CSS */
.img{
   width: 150px;
   height: 150px;
   background: url("cão.png") no-repeat;
}

I hope it helps you :)

  • Thanks for you answer, If I were using a static picture gallery I think that would be great, but Im using a Jquery complex gallery plugin which dynamically changes depending of user response. – azirion Dec 05 '14 at 02:05
  • hm...is it so complex to change the way of generation of the images? You can change this plugin to create
    instead what is creating, and apply these properties as a style rule. I know, that is a big job, but it'll work.
    – Mauricio Ribeiro Dec 08 '14 at 14:12
  • Thank you Mauricio for your reply. Since no one else answered and editing the plugin sounded too complex (for me) I decided to look for the next dirty option: I found a kickass software that is able to replace and rename my files in a very powerful way (bulk rename utility). So I striped all the filenames and uploaded the pics again, made the same on MySql and renamed all data within the tables, and it was done. My problem is gone. From now on, every pic upload is forced to be saved with "normal" characters ;) – azirion Dec 08 '14 at 20:49
  • aaah, very well! now, special characters no more hehehe – Mauricio Ribeiro Dec 08 '14 at 22:31