• Hi,

    When I upload an image to the Media library, I see WP reads some metadata, for example:

    Title – IPTC/Object Name

    Caption – IPTC/Caption

    I’d like to know, which metadata WP reads the Alternative text ands Description fields from?

    Thank you

Viewing 7 replies - 1 through 7 (of 7 total)
  • This function allows you to read out the data: https://developer.www.ads-software.com/reference/functions/wp_read_image_metadata/

    These are used here in the WordPress core to set the title and caption:
    https://github.com/WordPress/WordPress/blob/02d2fa959ab289de5a50a5545fa77282b5844747/wp-admin/includes/media.php#L481

    This means that what is read out as the title is also saved as the title in the media file. Caption to caption.

    The behavior can be changed by using plugins.

    Thread Starter norbre

    (@norbre)

    Hi, is that mean WP core only reads Title and Caption, nothing else like Description?

    As you can see in the first link, much more is read from the images. However, much of this is not saved, as there are no fields or use cases for this. Very few projects require information on the cameras used for photos. Plugins extend these possibilities so that, for example, you can also save technical information on the images and use it somehow in the frontend.

    Thread Starter norbre

    (@norbre)

    I use DarkTable for afterwork of my photos, and I store informations with the files, like Caption, Detailed description, keywords etc. For me exif data (aperture, shutterspeed etc) is not so important on my site, but desxription and keywords yes.
    When I export the final version of the images from raw, I can tell Darktable which data is entered in which field (for example Title –> IPTC/Object Name, Caption –> IPTC/Caption).

    I’d like that if I import an image to the media library I don’t have to enter the data manually.

    I thought that if I find out from which metadata read the description, then I don’t need to use a plugin.

    Take a look at the first link above. There you can see which field of the EXIF data of the images is used for which content. The caption is therefore taken from one of the fields


    IPTC Description field (2#120)
    EXIF UserComment field if [“title”] is unset AND EXIF:ImageDescription is less than 80 characters
    EXIF ImageDescription field if [“title”] is set OR EXIF:ImageDescription is more than 80 characters
    EXIF Comments field if [“title”] does not equal EXIF:Comments

    loaded. As you can see in the 2nd link, the caption is then saved as a description text / caption for the image. No plugin is required for this, it is WordPress standard.

    Have you tried it yet? If so, with what result? If it doesn’t work, where is the image so that you can test it yourself?

    Thread Starter norbre

    (@norbre)

    Hi,

    Yes, I saw the two links, but I have to say the second one is too much for me ??

    I’ve tried to figure out what field I need for Description but I don’t get it.

    Sorry but I don’t understand well, what that is mean “caption is then saved as a description text / caption for the image“. Caption and Description is a different text for me, for example Caption is “Sunset” and Description is “Beautiful sunset above the autumn forest.. .etc”

    Just for clearify.. When I edit an uploaded image in the Media library, I see theese fields from top to bottom: Title, Alternative text, Caption, Description.

    I can set Darktable to write the Title to IPTC.ObjectName and Caption to IPTC.Caption under the export process, but doesn’t matter which parameter I set for Description, the Description field remains empty after import in media library.

    You can see the description field in IPTC.Desctiption (= “DT-Descr”)

    Here is the test image:
    https://drive.google.com/file/d/1Ymf4jC3M0Luqs8Wx0idKJSp1d3DFFpJK/view?usp=sharing

    I took a closer look today. This is read from your image:

    View post on imgur.com

    WordPress only processes the title, as you can see. What WordPress does not do is process any part of this result as a description.

    This could only be solved with a plugin or individual programming. If you consider it a necessary feature in WordPress, you can also report it in the WordPress Core Trac so that developers can look at it and evaluate it: https://core.trac.www.ads-software.com/newticket

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.