help displaying copyright and other data

I'm not sure why I'm having so many issues tonight. I've searched the forums and the documentation, but am hitting a brick wall.

For reference, I'm using the Stopdesign theme and am dealing with image.php

I can figure out two different ways to display the title of a image:
<?php printImageTitle(true); ?>
or
<?php echo getImageTitle();?>

But I can't figure out for the life of me how to display other fields like city, state, copyright, and date (well, specifically, I only want to display year).

I'm sorry if this has been covered here before... I've looked and didn't find any answers. But I'm also burnt out right now so who knows.

Thanks!

Comments

  • affa Member
    I had meant to add... I see in the online docs that there is a function called getCopyright.
    But when I call this in the same manner that I see getImageTitle() called I get the following error:

    Fatal error: Call to undefined function: getcopyright() in /home/abc/public_html/xyz/zenphoto/themes/stopdesign/image.php on line 22

    which I assume means the function set needs to be required but i'm not savvy enough to be SURE this is what i need to do, nor where in image.php i should be doing such (other than somewhere near the top)
  • acrylian Administrator, Developer
    The error is correct. `getCopyright()` is a function of the image class. You need to call it via the image object: `$_zp_current_image->getCopyright()`.

    But you can do that even easier, simply use the template function `getImageData()`. This `echo getImageData("copyright")` prints the copyright field value (just noticed that the values are missing from our doc...)
  • affa Member
    You rock. I like that function. Unfortunately, I'm still having a few related issues:

    3 to be exact:

    1)

    while

    echo getImageData("copyright")
    echo getImageData("city")
    echo getImageData("state")
    echo getImageData("credit")

    all seem to work correctly,

    getImageData("title")
    getImageData("date")
    getImageData("description")

    all return nothing. is there something I'm missing? I think there are other functions I can call to get this data (since the Stopdesign theme already has them showing elsewhere) but why doesn't this function work across the board?

    2)
    Also, what IPTC field maps to Location?

    3)
    And, last but not least... while I can store quote marks in my IPTC data, ZenPhoto truncates at the ". Is this a bug? Is there a workaround (I'm trying to store size, as in the size of a painting, so, say: 3"x5"

    (NOTE: I can actually store quotes in the comment/description field... but I actually need to use that for a comment. Best case I figure out how to map to Location and use that for size.)
  • acrylian Administrator, Developer
    1) Because Title, description and date have separate functions (the exif/IPTC data gets transfered to them): getImageTitle(), getImageDesc() and getImageDate(). Take a look at your theme files and visit our functions guide, too...:-)

    2) That is a question for sbillard.

    3) Don't really now maybe it gets "killed" for MySQL reasons. Did you try escaping it with \"? Or couldn't you just write "3 x 5 inch"?
  • Locationis the IPTC Location field (2#092). All the field mappings are done in the function getImageMetadata() in functions.php.

    The problem with the quotes is a deficiency in the implementation. We will fix it.
  • affa Member
    Once again, thank you both.

    1) Ah, yes, I knew about these alternative functions for these three fields - I was just surprised getImageData() didn't handle all fields so that all could be accessed in one uniform way.

    2) Hmm. I'm using Exifer to edit IPTC data and don't see it listed (and I think I've tested every field but will try again). I'll look around for something different. (I would normally use something like Adobe Bridge but I need to pass this off to someone who will require a solution that is a) freeware and b) incredibly easy to use.)

    3) Do I need to report it anywhere or is this already taken care of? And thanks!
  • jlang Member
    For consistency which seems fairly important to a "zen" project, getImageData should handle these three fields. But from looking through the code, the only place I see getImageData() currently used is in printImageData() and that is itself not used in any of the current themes - so probably noone else noticed or cared.
  • acrylian Administrator, Developer
    affa: If sbillard says "we will fix it" he is most of the time half done...:-)

    jlang: I guess that is because the exif stuff was added later. title, date and description are the most important fields and have been there for ever.
    All themes use printImageMetaData for displaying all the exif data at once.

    Perhaps we could indeed clean up that a little sometime...
  • affa Member
    Wonderful! I might just need to grab a nightly build in a few days.

    One last, semi-related question.

    Can anyone explain this time travel problem?

    CODE:
    Date: <?php echo getImageDate() ?>
    Year: <?php echo date("Y",getImageDate());?>

    RESULT
    Date: 1974-12-30 00:00:00
    Year: 1969

    ?! What ?!
  • affa Member
    wanted to add - every image seems to result in 1969 (regardless of date which DOES print correctly) when converted to just year. I realize this isn't a ZP issue but if anyone knows what's up please let me know.

    ALSO - I just filed a bug report in the forum for two bugs I discovered while setting this all up.
  • `getImageDate()` does NOT return a timestamp. So that is why your `date("Y", getImageDate())` did not return what you expect. But, why not pass `getImageDate()` the format you want in the first place?
  • affa Member
    bravo. resolved.

    thanks so much!
  • Regards #3 above: `And, last but not least... while I can store quote marks in my IPTC data, ZenPhoto truncates at the ". Is this a bug? Is there a workaround (I'm trying to store size, as in the size of a painting, so, say: 3"x5"`

    The "get" functions return the raw data. It may have quotation marks in it. Before displaying it you need to expunge these characters. Use the php function `htmlspecialchars()' function to convert characters to something that can be displayed via html.
Sign In or Register to comment.