WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] When is image "description" ever used? (17 posts)

  1. Christiaan
    Member
    Posted 8 years ago #

    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.

  2. whooami
    Member
    Posted 8 years ago #

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

  3. Christiaan
    Member
    Posted 8 years ago #

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

  4. whooami
    Member
    Posted 8 years ago #

    thats what i typically do. :)

  5. Christiaan
    Member
    Posted 8 years ago #

    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?

  6. whooami
    Member
    Posted 8 years ago #

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

  7. Christiaan
    Member
    Posted 8 years ago #

    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.

  8. whooami
    Member
    Posted 8 years ago #

    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.

  9. Christiaan
    Member
    Posted 8 years ago #

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

  10. Christiaan
    Member
    Posted 8 years ago #

    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.

  11. shinigami
    Member
    Posted 8 years ago #

    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...

  12. pratian
    Member
    Posted 7 years ago #

    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.

  13. sketchbunny
    Member
    Posted 7 years ago #

    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.

  14. sketchbunny
    Member
    Posted 7 years ago #

    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>

  15. Christiaan
    Member
    Posted 7 years ago #

    sketchbunny, have submitted this as a bug?

  16. sketchbunny
    Member
    Posted 7 years ago #

    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.

  17. godwilling
    Member
    Posted 7 years ago #

    Can someone share their fixed files?

Topic Closed

This topic has been closed to new replies.

About this Topic