• Resolved rob764

    (@rob764)


    I have an image with exif title and description fields filled .
    I then load it in a gallery (by using ftp upload from the gallery edit page). I can see all the fields by clicking on the edit button of the image.
    I then added in the function.php of the theme the example for showing exif data under the image (found in the tips&tricks section)
    So far so good.
    However if I modify the caption/description fiels afterwards, nothing changes in the webpage, it remains stuck with the old data.
    No matter how I modify the fields they are not reflected on the web page.

    It seems that the method wp_get_attachment_metadata in the example:
    $meta = wp_get_attachment_metadata( SunshineFrontend::$current_image->ID );
    does not return update values.
    Even if I regenerate the images there is no change..

    Can somebody help? thanks!

    • This topic was modified 1 year, 7 months ago by rob764.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author WP Sunshine

    (@wpsunshine)

    It sounds like you found this code snippet to show the EXIF data:
    https://gist.github.com/sunshinephotocart/c719f397fa548c3f948fe3351d11173e

    If that is the case, this is only showing metadata and not the caption/description.

    Here is how to show the caption/description (which gets saved as the post_excerpt for an image in the WordPress database):
    https://gist.github.com/sunshinephotocart/9a761ed1e5ad57e9ae7456b257584f03

    Thread Starter rob764

    (@rob764)

    Thank you very much for the code snippet! Yes I was using the first one.
    The first snippet shows a “caption” which is from EXIF and is not the same “caption” of WP.
    Using the two snippets you provided I should be able to show the EXIF caption by default and if the post_excerpt is filled show it otherwise.
    In this way I can always show something under the photo.

    But the best would be to copy the Caption Exif into the post_excerpt at upload time.
    If you could point me at the right file/function to modify…that would be great!

    Plugin Author WP Sunshine

    (@wpsunshine)

    It does set the Caption EXIF to the post_excerpt on upload. You were saying that manually changing that caption/post_excerpt after upload was the issue here though which at this point it has been pulled out of the EXIF data and why showing only EXIF data was not showing the changes.

    Thread Starter rob764

    (@rob764)

    Sorry, there might be a misunderstanding…..
    I got what I was looking for here:

    uploads – Automatically Add Caption in image – WordPress Development Stack Exchange

    After upload, I have Alt, Description, and Caption all taken from EXIF Title… which is what I meant and needed.

    I put that snippet in the function.php and it works well.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How are exif data handled’ is closed to new replies.