I haven´t use img tag features like alt or title. I have lots and lots of images in my website, more than 3.500, because it is an Xbox game database.
Is it ok if in the in the title I put the name of the image (for example, alt=“halo_5.png” and in the title the name of the game (for example title=“Halo 5”?
As I have read it´s important for google positioning.
My SEO knowledge is limited but I think instead of setting alt="halo_5.jpg" to set it to alt="Halo 5" because the image file name is already known and therefore would be redundant.
So, the title feature is not necessary? What I have read is that is better to put both, but I cannot do it for each image, all are taken from a database using PHP.
I would have thought that because PHP is used to extract the image filename from a database it would be relatively easy to pass the name or to use the image filename to create the alt="<?= getAlt( $filename ) ?>"
I would have thought that because PHP is used to extract the image filename from a database it would be relatively easy to pass the name or to use the image filename to create the alt=“<?= getAlt( $filename ) ?>”
¡Thanks for the code! Unfortunately that way it will only work with a few games, as I wasn’t able to scrap all the information of the games from Xbox.com I had to introduce myself in the database, that means that I had also to download the game image one by one and give it a name. Anyway I have the name of the game in the database so I suppose that I can simply do something like this:
You need to remember that the primary purpose of alt text is to provide a text alternative for anybody unable to view the image, whether that is because they have visual difficulties and use a screen reader, or simply that the image has failed to load for some reason. This has the added benefit that it also helps search engines understand what the image is about, but it is not the main reason for adding it.
So the first thing to ask yourself, before adding the filename as alt text is “does this actually convey anything useful?” If not, then there is little point in doing it. (If the image is purely decorative and conveys no meaning, it is best to insert it as a background image where possible, and otherwise to use alt=“”.)
It´s very interesting. Yesterday I read the same you have told me, whenever you can use the images in the CSS. I´m my case I use the game cover sheet (I don´t know if I´m using the appropriate word) for the wrapper game background.
So what I can do is write something like this:
<img src="images/<?php echo $post['thumb'] ?>" alt="<?php echo $post['title'] ?>" cover sheet for Xbox One />
With the final result of:
<img src="images/Halo_5.png" alt=Halo 5 cover sheet for Xbox One />