Pull specific EXIF data into a PHP variable?

travelvice
travelvice's picture

Joined: 2005-07-16
Posts: 112
Posted: Sat, 2010-03-13 07:26

Howdy,

I'd like to pull the EXIF information on my single photo pages into a PHP variable. All I need is the Model string to compare against an ifelse statement.

Thoughts?

 
travelvice
travelvice's picture

Joined: 2005-07-16
Posts: 112
Posted: Sun, 2010-03-14 23:25

Frankly, at this point my preference would be to use something like this PHP code block in the photo.tpl:

{php}
$theimageurl = '____ need help with this _____';
$exif_model = exif_read_data('$theimageurl', 'IFD0', 0);
$emodel = $exif_model['Model'];
{/php}

But I need to be able to place this code snippet into the variable to give me the image URL:

{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.sourceImage.id`"}

Any help?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 6138
Posted: Sun, 2010-03-14 20:46

enable debugging in config.php to see the smarty variables that are available in each template.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 6138
Posted: Sun, 2010-03-14 23:34
$this->_reg_objects['g'][0]->url(array('arg1' => "view=core.DownloadItem",'arg2' => "itemId=".($this->_tpl_vars['theme']['sourceImage']['id']), 'forceFullUrl' => true, 'htmlEntities' => false), $this)

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
travelvice
travelvice's picture

Joined: 2005-07-16
Posts: 112
Posted: Mon, 2010-03-15 00:43

Wow -- that's really outstanding code! Very accurate! Thank you!

{php}
$theimageurl = $this->_reg_objects['g'][0]->url(array('arg1' => "view=core.DownloadItem",'arg2' => "itemId=".($this->_tpl_vars['theme']['sourceImage']['id']), 'forceFullUrl' => true, 'htmlEntities' => false), $this);
$exif_model = exif_read_data($theimageurl, 'IFD0', 0);
$emodel = $exif_model['Model'];

//example
echo 'the camera model is a ' . $emodel;
{/php}
 
travelvice
travelvice's picture

Joined: 2005-07-16
Posts: 112
Posted: Mon, 2010-03-15 03:48

for what it's worth, you can see an example of how I ended up implementing it here