Help Printing Attributes of Media Attachments (images)



I’m looking for a way to manually print the php “attributes” of media attachments in WP. I’m not sure if attributes is the right word to use here, perhaps properties is the correct term in this situation.

Basically, I have a function I added to my theme to display a simple html button on each image within a gallery. I am getting the buttons to appear for each image, however the variable I am passing into the output statement does not appear to be correct as the buttons are not finding an acceptable/unique parameter for the “$post_id”.

The shortcode I am using is to output the buttons is:

get_favorites_button($post_id, $site_id)

My output statement is as follows:

output .= get_favorites_button( $id );

I’m trying to find a way to print the all of the variables that are available to php for media attachments in my theme, each file has a unique name and some custom fields are added via Media Library Assistant (converting IPTC tags in the images).

So I think I just need a way to print the available attributes php can use. If I can print out the available attributes for a media attachment then I would hope I can identify a suitable variable out of those attributes that I can pass into my output statement (in other words a unique variable that I can use to get a unique button for each image).

Right now I am using:

print "<h2>" . "$id is: " . $id .  $gallery_ids . "</h2>";

To try and view what the output is reading for the $id field and I am not getting a readout of unique identifiers (all the images are showing the same exact output for $id, and the $gallery_ids are also identical) so I know the $id variable is not the variable I need in this case…I hope this makes some sense.

Any help would be most appreciated!



I found the exif_read_data() function, is this the function I need to display the properties of an image??

If so, how can I write a statement to output said properties so that I can view them??

Any help would be huge with this, thanks~