template-functions addition?

I've been doing lot's of hard-core theme development and think this would be a nice addition just below `getImageMetaData()`in template-functions.php. It would add nice bit of abstraction for `printImageMetadata()` and would easily allow custom EXIF display that doesn't rely on tables (that's my aim anyway).

If one of the regular developers thinks it's a good idea and worth a commit then just say the word an I'll update `printImageMetadata()` to use it.

`
/**
* Returns the Metadata infromation from the current image,
* but only the fields enabled under admin->options->image->EXIF display
*
* @param $image optional image object
* @return array
* @author timo
*/
function getDisplayEXIF($image=NULL) {
global $_zp_exifvars, $_zp_current_image;
if (is_null($image)) $image = $_zp_current_image;
if (is_null($image) || !$image->get('hasMetadata')) return false;
$exif = $image->getMetaData();

$displayEXIF = array();
foreach ($exif as $field => $value) {
if ($_zp_exifvars[$field][3]) //the enable field
$displayEXIF[ $_zp_exifvars[$field][2] ] = $value;
}
return $displayEXIF;
}
`

Comments

  • acrylian Administrator, Developer
    Well, tables are not necessarily bad if they are used as tables (as they are used on the exif display), just layout tables are..;-)

    You can always make a plugin or theme function. I don't use exif data myself a lot but sounds like a good idea. Please create a ticket and attach the modified code. We then take a look later.
  • Does seem like the proper way to go. Please do update the code and attach to a ticket.
  • I've created two tickets:
    http://www.zenphoto.org/trac/ticket/1685
    That includes the afore mentioned code.

    and

    http://www.zenphoto.org/trac/ticket/1686
    which makes it possible to get a thumbnail of custom size.

    I've tested each extensively, they should be ready to go. Each is at the same level of abstraction as existing comparable functions and are as compatible as can be.
  • acrylian Administrator, Developer
    About the first we did talk but about the 2nd see my ticket comment. Sbillard will have the last word though.
Sign In or Register to comment.