Adding alt and title tags to files in file manager?

Permalink 2 users found helpful
I'm not sure where to add alt tags to images on my site. When I upload images into the file manager, there are fields for description and tags (not sure what their uses are) as well as assigning a folder, but I don't see where to add the alt tags. On the live site, when you hover over an image, the image name is displayed.

I would love to be able to add alt tags at the file manager level and not coded for every instance of that image on the site.

RandomBrad
 
frz replied on at Permalink Reply
frz
not every block is going to use the same data in the presentation layer, but you might try changing the title tag in the file manager. At least in the content block this is where the alt tag comes from.
RandomBrad replied on at Permalink Reply
RandomBrad
Well how about that. If you click title and not the title field it lets you change it. Not sure how I missed that earlier.

I did change and add the title, which previously was automatically populated with the filename. When I refreshed the product page it still did not reflect the title. I then changed the image on the product page with the image that has the title tag changed and still no title in the code. In fact, it brings up another question about the image. In the code, the image name is a random string instead of the actual image name. Isn't that counterproductive to having good file names for SEO benefits?
brabin replied on at Permalink Reply
Did you ever get an answer to this question? I am wrestling with the same issue now.

Barry
RandomBrad replied on at Permalink Reply
RandomBrad
Nope, never heard anything more and I didn't look into it further. I'd like to think it's something they are planning on changing?
prestressed replied on at Permalink Reply
prestressed
Franz, if you're there, I've just been discussing this on another thread. I know the alt tag comes from the Title field in File Manager, but what was/is the Description field in File Manager meant to be for? I was assuming a title tag, but it seems not.

It is super-confusing when you need to set the Title field in File Manager to get an alt tag (not a title tag) and yet if you insert an image, you set the alt tag via a field called Image Description. The terminology is all over the place.

not to mention that updating image Titles in file manager doesn't seem to propagate through to images in Content blocks, as Barry pointed out recently. It is just very difficult to explain all this (as I have been finding to my cost this week!) to an end user.
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
I know this is an old thread but I was struggling with the same issue,
What worked for me was to use the "Content" block to add an image and then edit that using the advanced editors "html" facility,
where you get the "style" declaration just add the title to the style,
Example - <img style="float: right;" title="Your Title Here" .......
malthoff replied on at Permalink Reply
malthoff
What is the status of this thread? Is it still not possible to edit the title tag in file manager?
KarenSloan replied on at Permalink Reply
KarenSloan
I also am after an answer to this. It is going to be a huge job for me as well to update everything. It would be easier to be able to do it from the File Manager.
malthoff replied on at Permalink Reply
malthoff
I had a look at the code and I can clarify things now.

If you add an image in the content block it gets inserted ONCE as a HTML string (it is done by the editor TinyMCE on Javascript basis). So later changes on the title cannot be reflected in your site until you remove the image and insert it again.

What Franz meant by the somehow abstract answer "not every block is going to use the same data in the presentation layer" is that the file manager is not only an image manager but for any file type. Every file can have a title but an alt tag does not really makes sense for an PDF for example.

That means if you want to have the ability to enter a title tag on images create the Attribute under Dashboard/Files/Attributes, make it of type text and name it "title". Now, If you open the property panel of a file in the file manager your newly created attribute is shown at the very bottom under "height" und "width". Enter your title text there and dont forget to safe (click the icon right to the text field).

For the content block to use your new attribute copy the content block from /concrete/blocks/content to /blocks/content. Open the file editor_init.php and look for the function: ccm_chooseAsset. In there you got two switch cases and one of the is for images. As you already might guess while looking at the code here we have the opportunity to add our title tag. Just change
tinymce.extend(args, {
            src : obj.filePathInline,
            alt : obj.alt,
            width : obj.width,
            height : obj.height,
         });

to
tinymce.extend(args, {
            src : obj.filePathInline,
            alt : obj.alt,
            width : obj.width,
            height : obj.height,
                 title : obj.title // <-- your title tag
         });


From now on tinymc grabs your title tag but it does not change your already added content, you need to insert it again for this method to work.