Skip Navigation

[Resolved] Extracting metadata from a media file and outputting it

This support ticket is created 5 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by josephC-5 5 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#1323075

Hi there,

I have a custom image field connected to a custom post type, artwork. How can I use the Toolset interface to extract and output metadata related to the image?

For example, let's say I upload a file named screenshot.png, and in the Media Library I add a Title ("Finder Screenshot"), Caption ("Finder Screenshot with special information"), and Description ("This is a Finder Screenshot with some special information").

If I want to display the image and the three pieces of metadata on the singular artwork page, how do I do that? And can I do that using PHP code, too?

Thank you!

Saul

#1323171

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Joseph,

Thank you for getting in touch.

To get this clear, your images will be assigned to One image per post correct?

If so then I would recommend that you use the Post title as the title of the image and the post body as the description of the image as it will be a little more difficult to display these meta items from the images itself.

Please let me know what you think of this.

Thanks,
Shane

#1323457

Shane,

Thanks for your response. Each post will have multiple images associated with a given post, so I'm going to need to travel the more difficult path. Am I going to have to use wp_get_attachment_image() and other WP PHP functions?

Saul

#1324491

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Saul,

This will get a little complex, because we are going to have to do all the styling information in the custom function.

So when we are returning the information we are returning it already formatted.

However I have another suggestion. Rather than using repeatable image fields, why not use our repeatable field groups.

Where in the group you will have the Image, the title, the description etc. Then each image can be uploaded to a post with its respective information.

From there you can use views to display the images plus their attributes that you've added in the repeatable field group.

Please let me know as I think this is the best solution without having to write any code.

Thanks,
Shane

#1324669

Shane,

That's an interesting idea, and much simpler to implement. I already have field groups configured for a different purpose (https://toolset.com/forums/topic/creating-a-gallery-of-galleries/).

Perhaps it comes down to where I want the metadata to live. What I like about keeping it in the media library is that it's directly connected to the image. With your solution, a user can change the image and fail to update the additional fields.

I suppose it would be important to tightly couple the metadata if the image appeared in multiple places and identical information needed to be displayed in each location. I don't think that's the case here.

Thanks for your help!

Saul