We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51020
    • 670 Posts
    I just found the filedir Extra, which allows me to load files from a directory - which means I can create a really simple gallery by simply ftp'ing images into a folder - which is AMAZING!

    But...

    I want a way of adding a description to each image.
    I have the file name, which serves as a title - but I was hoping to bring in the EXIF/META data from the image, as this comtains tags, and a description - does anyone know of a way to pull this sort of data?

    Due to the way the plugin works, there are no individual resources for each image, so I can't just add a TV

    Any ideas?

    Andy
      • 44580
      • 189 Posts
      I'm not aware of any easy way to do this. I'm building a site with the same requirements. My solution was to write a snippet that fires every time a file is uploaded. In the snippet, I use exiftool to extract all the metadata from the image and save it into custom DB tables. I then query these tables when displaying an image on the front end.

      This works really well but it was a lot of work setting it up. If you discover a better way, I'd love to know.
        • 3749
        • 24,544 Posts
        There is this PHP function: exif_read_data(), but it would be very inefficient to read the data every time you need it. gissirob's solution is much better.

        Depending on how many images you have, you could create a chunk named after the image name that contains the data you want to display.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting