IPTC data implementation through printImageData

Hi.

Fantastic software and one I'm busy using to fine tune a website gallery for my photography.

I noticed that upon import (I FTP to folders on my server) that ZenPhoto very cleverly populated certain fields with information from the IPTC data I embed in each file. I LOVE IT. However I'd love to embed this on the image.php pages that display my images.

So far I have used the following codes, but for some reason it defaults to each having it's own line (which I dont want).

`<?php printImageData("copyright", "Copyright"); ?>`

For copyright for example. I also use the Location, State, Country codes and would love to have them display something like this:

[strong]Picture taken at :[/strong] Location, State, Country to display on one line.

How do I do this??

I know which codes to use (I think), but no idea how to put this code into the image.php file.

Any help would be appreciated. I've read the functions in the documentation, but not **really** knowing PHP very well (still learning) it's a bit tough with things like VOID etc.. which I do not understand, especially the arguments and structure.

Regards,

Simon

Comments

  • In general, for each `print` type function there also exists a `get` equivalent. In this case `getImageData()`. (See the functions guide on the Zenphoto WEB site.) The `get` functions return the raw data from the field which you can format howerver you want.

    So: `echo 'Picture taken at:" '.getImageData('location').', '.getImageData('state').', '.getImageData('Country');`
  • Thank you!

    This works perfectly!

    Your help and gallery are really appreciated!
  • The above is working perfectly, but I am wondering whether the IPTC codes are only limited to those fields I can see in the image edit window?

    Do tags such as Event, Category, Usage Rights Terms, URL, etc get stripped out of the JPEG?

    Which of the IPTC tags remain, and what are their "codes" to use in the getImageData code?

    Thanks!
  • You can use the getImageData() function to retrieve any item in the database. However, not all IPTC fields are captured by zenphoto. If you look at the table defininition of the image table you will see all the fields.
  • Thanks! Slowly getting to grips with this.

    I have another question.

    I've used the code `<?php echo getFullWidth() . " x " . getFullHeight(); ?>` to display the pixel dimensions of the file below the photo on the image.php page. Is there a similar code to display the file size in MB?

    Thanks!
  • You would have to use the PHP filesize() function to get the size. Use the image `localpath` parameter.
  • Thanks sbillard.

    I'm still learning PHP, so where would I insert this? And what tags do I put this inbetween?

    And last question (promise!!) is there a PHP tag that I can drop in to display the filename of the picture being displayed?

    I have read through the functions and still not always sure how to put these into my template I'm building! Slow, but with your help learning more each day.

    Many thanks!! (again)

    Simon
  • acrylian Administrator, Developer
    You can get the file name of each image by using the object of the current image `$_zp_current_image->filename`.
  • Thanks acrylian, but as a *total newbie* where would, and how would I implement this on the code?

    I've started by tweaking the default theme (still learning, so best for me). So where abouts would I insert this?

    All your help (especially sbillard) is much appreciated!
  • acrylian Administrator, Developer
    Just put `<?php echo $_zp_current_image->filename; ?>` where you want the file name to be printed. May I recommend to read our theming tutorial on our user guide section, too?
  • Hi Acrylian.

    Many thanks.

    I have downloaded the document and printed it! :-) I am new to this and learning so much so quickly. It's just slow as I have to edit on my machine, then FTP the php file back to the server, then refresh the page to see the changes. Sometimes I just want to run and I can only walk!

    Will post a link when I'm done. I am really loving ZenPhoto. I'm sure there will be lots of questions still!
  • acrylian Administrator, Developer
    I recommend to install a local server on your machine using some of the LAMP, WAMP or MAMP packages (depending on your OS). That is much more convenient for learning and testing.
  • Thanks. I run on Apple Mac OSX 10.5. I know it's linux based, but no idea how to set up a database etc.

    I will ask my friend.

    Thank you again.

    Simon
Sign In or Register to comment.