Support » Fixing WordPress » When is image “description” ever used?

  • Resolved Christiaan

    (@christiaan)


    When you upload an image you have the option of adding a title and a description. The title you used is added to the title tag when you post an image (as an aside, in the “Insert/edit image” popup it’s then called “Image description”).

    I’d like to know if and when the image description you add when you upload the image is used?

    I’d also rather use my image description in the title tag when I post images, so I’ve started leaving the description box blank and simply adding a descriptive title.

Viewing 15 replies - 1 through 15 (of 16 total)
  • whooami

    (@whooami)

    Member

    the description you enter is what populates the alt=””, which is an accessabilty item, screenreaders for instance will look for that.

    Christiaan

    (@christiaan)

    Ah okay, so best to make sure its filled in. Think I’ll just add same text to title and description.

    whooami

    (@whooami)

    Member

    thats what i typically do. 🙂

    Christiaan

    (@christiaan)

    Hmm, you know the floating title when you mouse over a link, is there any way to invoke this for an image that isn’t linked to anything?

    whooami

    (@whooami)

    Member

    title =”blah”, you can use title= on any images

    Christiaan

    (@christiaan)

    How hang on, I thought it did anyway. No what’s going wrong is that when I add an image to one of my posts the title tag is not being added, only the alt tag. Is there any way to make it add the title tag (i.e. the description) too?

    As opposed to adding it manually.

    whooami

    (@whooami)

    Member

    I dont use 2.** so I dont know what your backend looks like when you go to upload. Ive edited my backend so that I have both textboxes available, and can assign alt and title tags at the point that I upload. Certainly it can be done for 2.** if its not there already.

    Christiaan

    (@christiaan)

    Hmm, I hope so. I assume I need to configure my config.php file or something. I’ll have a search around.

    Christiaan

    (@christiaan)

    Actually I’ve just noticed that whatever you put in the Title text box is what gets used in the alt tag. If you then open the image editor, by default it also uses whatever you put in the Title text box.

    The Description box text doesn’t appear to ever get used.

    I think this behavior doesn’t make any sense. The Title you entered should be used in the “title” attribute, and the Description in the “alt” attribute…

    Christiaan

    You’re problem makes plenty of sense.

    I have the same problem. WordPress is calling up the title text for the alt text. The “title” as entered into the inline image uploader is entered into the MySQL database as a post_title, the “description” field enters it a post_content. However, in the end the alt text is being called from the post_title.

    I’m not sure where this glitch is to be found. I need to change it so the description is displayed.

    You have to edit inline-uploading.php (in your wp-admin folder). Go to around line 251, and find the line that says

    <img id=\"image{$ID}\" src=\"$src\" alt=\"{$title}\" $height_width />

    Change this line to

    <img id=\"image{$ID}\" src=\"$src\" alt=\"{$descr}\" title=\"{$title}\" $height_width />

    This should take effect the next time you upload something. Unfortunately, the change won’t apply to anything you’ve already uploaded, because the HTML is already stored in your database.

    Sorry, please disregard my first post. I actually had to change a lot of other things in inline-uploading.php to get it to work properly. Here are all the changes.

    Line 143:
    $attachments = $wpdb->get_results("SELECT ID, post_date, post_title,
    Add post_content to the list between post_date and post_title.

    Line 243:
    Find the line
    $title = wp_specialchars($image['post_title'], ENT_QUOTES);
    After this line, add the following line:
    $descr = wp_specialchars($image['post_content'], ENT_QUOTES);

    Around line 247:
    Make this change for the two lines that begin with imga[{$ID}] and with imgb[{$ID}]. Replace alt=\"{$title}\", with alt=\"{$descr}\" title=\"{$title}\" or whatever change you wanted to make.

    Around line 252:
    Make the same change as above. It should look like
    <div id='div{$ID}' class='imagewrap' onclick=\"doPopup({$ID});\">
    <img id=\"image{$ID}\" src=\"$src\" alt=\"{$descr}\" title=\"{$title}\" $height_width />
    </div>

    sketchbunny, have submitted this as a bug?

    Christiaan: No, this probably won’t be considered a bug. It looks like the developers purposely changed how the “description” is used, at least in this version. I liked the old style, so I made this fix.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘When is image “description” ever used?’ is closed to new replies.