No alt tag for images

Found a bug? Tell us!!
Post Reply
abdussamad
Regular
Posts: 117
Joined: Fri Apr 21, 2006 10:11 pm
Location: Karachi, Pakistan
Contact:

No alt tag for images

Post by abdussamad »

I think I found a bug in the s9y media manager including the one included with 1.1. The alt tag is not included for images inserted via the media manager. This breaks xhtml validity. Usually this occurs when thumbnails of images linking to the full sized version are inserted.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: No alt tag for images

Post by garvinhicking »

Hi!

In the serendipity_editor.js, which is responsible for inserting those <img>s there's always an alt tag (even though its empty).

Can you show us an example blog entry where you find this behaviour?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
abdussamad
Regular
Posts: 117
Joined: Fri Apr 21, 2006 10:11 pm
Location: Karachi, Pakistan
Contact:

Re: No alt tag for images

Post by abdussamad »

garvinhicking wrote:Hi!

In the serendipity_editor.js, which is responsible for inserting those <img>s there's always an alt tag (even though its empty).

Can you show us an example blog entry where you find this behaviour?

Best regards,
Garvin
I think the alt attribute to the img tag is missing:

http://cricketgame.info/archives/8-testing-s9y.html

http://validator.w3.org/check?verbose=1 ... g-s9y.html
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: No alt tag for images

Post by garvinhicking »

Hi!

Are you using the WYSIWYG editor to insert this link? It might be that the editor is stripping empty tags?!

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
abdussamad
Regular
Posts: 117
Joined: Fri Apr 21, 2006 10:11 pm
Location: Karachi, Pakistan
Contact:

Re: No alt tag for images

Post by abdussamad »

garvinhicking wrote:Hi!

Are you using the WYSIWYG editor to insert this link? It might be that the editor is stripping empty tags?!

Best regards,
Garvin
Yeah I think your right. IF I use the standard editor the alt attribute is there. So I guess the media manager should specify some alt text? Perhaps the path to the image or the file name?
carl_galloway
Regular
Posts: 1331
Joined: Sun Dec 04, 2005 5:43 pm
Location: Andalucia, Spain
Contact:

Post by carl_galloway »

As we move forward to v1.2 I'd like to see a title for the image which can be automatically inserted into the alt field. Some users wouldn't give their images a title but abdussamad's suggestion of using the file name is worth considering. Can we also add a title and description for the folders within the uploads directory? I know this has been mentioned somewhere else but I can't find it right now.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Specifying an ALT/Title-Attribute is a good request, but it's rather painfully to implement and might take a while.

Implementing "path" properties is even more painful, as we need to create a completely new table for that and change all queries that are related to path permissions.

Most of the work on the 1.1 gallery was sponsored by a customer, and since he doesn't need those features, chances are it might take me a longer time to find free time for implementing them. :-(

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
abdussamad
Regular
Posts: 117
Joined: Fri Apr 21, 2006 10:11 pm
Location: Karachi, Pakistan
Contact:

Post by abdussamad »

Well something is better than nothing and so a small change to serendipity_editor.js results in the path to the image file being set as the alt text (s9y1.1 lines 210-218):

Code: Select all

if (f['serendipity[align]'][0].checked == true) {
        img = "<!-- s9ymdb:" + imgID + " --><img width='" + imgWidth + "' height='" + imgHeight + "' " + (styled ? 'style="border: 0px; padding-left: 5px; padding-right: 5px;"' : '') + ' src="' + img + '\" alt=\"' +img +'\" />';
    } else if (f['serendipity[align]'][1].checked == true) {
        img = "<!-- s9ymdb:" + imgID + " --><img width='" + imgWidth + "' height='" + imgHeight + "' " + (styled ? 'style="float: left; border: 0px; padding-left: 5px; padding-right: 5px;"' : '') + ' src="' + img + '\" alt=\"' +img +'\" />';
        floating = 'left';
    } else if (f['serendipity[align]'][2].checked == true) {
        img = "<!-- s9ymdb:" + imgID + " --><img width='" + imgWidth + "' height='" + imgHeight + "' " + (styled ? 'style="float: right; border: 0px; padding-left: 5px; padding-right: 5px;"' : '') + ' src="' + img + '\" alt=\"' +img +'\" />';
        floating = 'right';
    }
In case anybody is interested you can download the file for s9y1.1 here. For 1.0 here
schimanke
Regular
Posts: 161
Joined: Mon Jan 07, 2008 4:38 pm
Location: Hameln, Germany
Contact:

Post by schimanke »

Though this posting is already more than a year old, I'd like to bring the topic back on top. I am still missing an automated setting of the alt-tag when inserting an image using the WYSIWYG editor. Will there be anything inthe future?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

No volunteers yet showed up for implementing this. The code foundation etc. is all there, it can be solved with a plugin.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
julianhopkins
Regular
Posts: 17
Joined: Tue Mar 18, 2008 4:07 am
Location: Malaysia
Contact:

Re: No alt tag for images

Post by julianhopkins »

Hi, sorry if this is a dumb question, but is there any way to put in ALT text manually? Is it in the image properties?
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: No alt tag for images

Post by Don Chambers »

julianhopkins wrote:Hi, sorry if this is a dumb question, but is there any way to put in ALT text manually? Is it in the image properties?
It is not a dumb question. If you are using the wysiwyg editor, there is a button that looks like a page with < > on top of it... this toggles between wysiwyg and html model... toggle it to html mode and you can enter the ALT text manually.
=Don=
julianhopkins
Regular
Posts: 17
Joined: Tue Mar 18, 2008 4:07 am
Location: Malaysia
Contact:

Re: No alt tag for images

Post by julianhopkins »

OK got it :) Thanks! So basically, I just enter it in every time I am putting a picture into my post.

For anyone out there who, like me, wasn't sure where the proper place was to put the alt tag, here is an example (the alt tag text in red)
<img class="serendipity_image_center" width="466" height="300" src="/uploads/jh_pic_090227_BombGaza.jpg" alt="Unexploded bomb in Gaza" />
konus
Regular
Posts: 334
Joined: Mon Jun 16, 2008 1:57 pm
Location: Dresden, Germany
Contact:

Re: No alt tag for images

Post by konus »

I really would LOVE the possibility to enter the alt tag in the mediamanager :D
Post Reply