Support » Plugin: Lightbox with PhotoSwipe » show exif

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Arno Welzel


    Do you have any suggestion how and where the data should be displayed? As part of the caption?

    My preference would be: below the image in landscape and beside in portrait mode

    • This reply was modified 1 month, 2 weeks ago by  Henk.Jan.

    edit: to show camera (focal length,aperture,shutterspeed,iso)

    • This reply was modified 1 month, 2 weeks ago by  Henk.Jan.

    here’s an example I manually applied: example and klick on a image

    • This reply was modified 1 month, 2 weeks ago by  Henk.Jan.
    Corrado Prever


    I really appreciate that EXIF feature will maìke your plugin the number one among photographers.

    Add the exif below caption on landscape and on the right side in portrait mode.

    Plugin Author Arno Welzel


    Thanks for the info. At the moment I am busy with other projects, so it will take a bit, before the feature can be added. But I’ll see, what I can do.

    • This reply was modified 4 weeks, 1 day ago by  Arno Welzel.

    Hi there I decided to start from zero.
    I made myself a simple function to get exif data and integrated in photoswipe.
    I was able to add the data to the caption.
    Now I get caption + exif ( one string )

    All is ok but…

    when I use the button of photoswipe to share pics on pinterest/twitter will get also the exif data as get the caption (and I do not want that).

    I need to set this sharing problem.

    The best way I think is to add the data not to the caption but to another markup in photoswipe… still no idea.

    If interested cann share with you the code.

    Plugin Author Arno Welzel


    So far I had no luck with exif_read_data() – depending on the camera model this function will not see any data at all from the EXIF header. With wp_read_image_metadata() it’s the same.

    I did not get focal length, aperture or shutter speed – the pictures are from a Sony RX100 M4. With a Canon EOS 750D it works better, but how camera manufacturers use EXIF is far from being a “standard” 🙁

    So yes, please share the code. I would like to see your solution for this. I can integrate your changes and fix the problem with the caption. You can also create a pull request at

    Plugin Author Arno Welzel


    Ok, I found my problem: I had an image optimizer plugin installed and forgot to disable the “remove all metadata” option m(.

    I’ll prepare the EXIF option for the next update within a couple of days.

    Hi Arno
    Super! It makes this to the greatest Lightbox apps
    I’m very happy with it.
    Big thanks

    With kind regards,

    Plugin Author Arno Welzel


    I just published an update to version 2.7 which now also includes the display of EXIF data in the caption.

    See as an example.

    The EXIF data is a separate text block which can be styled if needed (CSS class pswp__caption__exif) and is ignored when sharing an image.

    Putting the EXIF data next to the image for portrait images is not implemented, since this would not work well in mobile view. However if anyone has a good idea how to solve this, pull requests are always welcome.

    Hello there
    Man you did a great job indead!! Thank you SO MUCH …. all is working nicely now and is just matter to style.

    Your plugin will be number one as has all the main features:

    1) proper zoom on mobile
    2) proper nice view on desktop
    3) is simple
    4) is using WP native gallery and for me is a plus
    5) has a good sharing script for the main social for the single photos and not just the page
    6) and NOW is also showing EXIF

    I checked for days all your code and I was so near to the solution as I got proper exif data as attributes to the thumbnails and pushed to the element array.
    I was lost on JS on how to output them… only now I saw the function “addCaptionHTMLFn” silly me.

    By the way I wrote a total different PHP code using a wordpress function
    “”wp_read_image_metadata”” and all my work is far more primitive with no option.
    Beside I did not use DB to save any data (just wondering why you make al those table).

    Here is my 2 cents code…

    In the function outputCallback($matches)

    $attr .= ‘ data-exif=”‘.exifdata($file).'”‘;

    function exifdata($file) {
    $datiexif = wp_read_image_metadata( $file );
    $tempo = $datiexif[“shutter_speed”];
    $tempopulito = decimal2fraction ($tempo);
    $tuttidatiexif .= ‘ || ‘.$datiexif[“camera”];
    $tuttidatiexif .= ‘ || f/’.$datiexif[“aperture”];
    $tuttidatiexif .= ‘ || ‘.$datiexif[“focal_length”].’ mm’;
    $tuttidatiexif .= ‘ || ‘.$tempopulito.’ sec’;
    $tuttidatiexif .= ‘ || ISO ‘.$datiexif[“iso”].’ ||’;

    function decimal2fraction ($number)
    list ($whole, $numerator) = explode (‘.’, $number);
    $denominator = 1 . str_repeat (0, strlen ($numerator));
    $GCD = GCD ($numerator, $denominator);
    $numerator /= $GCD;

    $denominator /= $GCD;
    if($whole == 0)
    return sprintf (‘1/%d’, round($denominator/$numerator));
    return sprintf (‘%d 1/%d’,
    $whole, round($denominator/$numerator));

    function GCD ($a, $b)
    while ( $b != 0)
    $remainder = $a % $b;
    $a = $b;
    $b = $remainder;

    return abs ($a);

    Plugin Author Arno Welzel


    @artphotoasia Thanks for the feedback and your code snippet.

    Regarding the database table: this is used to cache the image data (width, height and now EXIF data as well), so it doesn’t have to be read from the file itself with every request. The idea is first to check the database if there is already an entry about the image and only read the image file if needed. There is also a cron job in the plugin which will removes old cache entries, so the table doesn’t grow endless.

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