Drupal 7 - Exif values from Images

Last modified
Sunday, February 5, 2017 - 21:15

Content managers have to deal always with metadata provided by imagery of your website, this can be a tedious task for them and obviously it takes time to fill out all the meta data for your images so they can be  properly displayed on the site, indexed by search providers, etc.

One of the easiest ways I found to get information from an image file on Drupal is by using a module called Exif, this module uses the exif specification format to get the information used by digital cameras for example. This module provides a variety of information extracted from an image field on Drupal and it provides a friendly way to integrate that information as content, so content managers and developers can make use of this content in different ways avoiding entering content.

I'm going to show you on this post how to configure Exif module with Drupal in order to extract image information using exif and group this information into fields for a nice display.

First you are going to download and enable Exif and Field Group modules, the first one as I mentioned will help us get the image info and the second one will help is grouping the fields that we would like to display.

In order to configure Exif, go to admin/config/media/exif/settings and set there the values for the contentype of your images etc. 

to find all the values that this module can get of an image go to  admin/config/media/exif, this page contains all the placeholders values for the fields that we will be using as examples for display.


So, let's create a contentype called “Photo” and add a new field for it of type “image“.

Once you are done configuring your new field, add a new Group, you will find the New group fieldset at the bottom of the Manage fields page of your contentype, once you added the new group, let's add the photo fields that we want to and group them into our newly created group, to do so, create a new Text field and for Widget select: “metadata from image”, after you save the field and see the config page for this field, set the “exif field data” dropdown to match the field that you want to display, for example, select “file_filename” and this will display the file name of the photo taken from exif. 

Again, under this path: admin/config/media/exif you can find all the available fields – values for the information to be displayed, save the configuration, and we are almost done, we finally just need to set the display order for this new group that we created for the contentype, so just go to the “Manage Display” section of your contentype and configure the output of your group field depending on your need, remember that you are handling CCK fields so the behavior of these fields is as any other. 

Alright, that's pretty much it, if you go to any node page of your Photo contentype you should see the fields of your field collections displayed as in the following screenshot:

 

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.