getImageTitle has changed functionality

I'm trying to upgrade from 1.2.7 (just to 1.2.8 to start with) and I've encountered what I think is a change in the functionality of getImageTitle.

In my system, I use the file name as part of the page header and I put the caption below.

I used getImageTitle to get the file name and printImageDesc to print the caption.

Now getImageTitle seems to be showing the caption if there is one, and the file name if there isn't a caption. getImageDesc seems to do almost the same thing, but just shows blank if there's no caption.

Is there a function that I can use that just fetches the file name?

Thanks in advance!

Comments

  • acrylian Administrator, Developer
    The behaviour has not been changed. getImageTitle() shows the file name for newly uploaded images if you don'T give it a title or have added one to the file itself using meta data.

    getImageDesc() shows the description. It shows of course nothing if you did not add anything on the backend or again prior to uploading via meta data.

    `$_zp_current_image->filename` gets the file name of the current image if in image context.
  • hmm... i think i might have figured out why this is happening.

    i edit my photos in Lightroom, add a caption, and export them for ZP. when I import them into ZP, they show up with BOTH the title and desc showing the caption that i input in Lightroom. perhaps this didn't happen back in 1.2.7 because i'm certain that functionality i used to observe is correct. so my theory is that when i imported previously the Title field was not filled in; only the description field.

    is there any way to import such that the caption only flows into the Description field? it seems silly to populate both fields with the same thing.
  • Maybe something has changed with lightroom. It is notorious for its misue of EXIF fields.

    Zenphoto follows the EXIF/IPTC specification:

    The image title comes from one of the followind (in priority order)
    IPTC Object Name
    IPTC Image Headline
    EXIF Description[sic]

    if none of these are set it uses the defaulttitle (the display name)

    The description comes from:
    IPTC Image Caption

    Regards EXIF Description--see Table 3 TIFF Rev. 6.0 Attribute Information Used in Exif of the spec. There you will find under D. Other tags "Image title ImageDescription 270 10E"

    All this is unchanged. However there may have been issues in the past of not processing the metadata at the proper point in the image instantiation sequence such that the default title might have already been set.

    Anyway, it would seem that lightroom is storing the description in the title field as well as the IPTC Image Caption. That is the only way it can show up in both the ZP title and ZP description.
  • i don't think anything has changed with Lightroom since the vast majority of my galleries were imported a long time ago and i'm seeing this behavior with all of them. but that's not to say that Lightroom isn't a possible culprit somehow.

    did ZP use the title field in previous versions? i'm assuming it did, but i don't have an old version running. i think i would have noticed if i had a duplicate field. i'm wondering if somehow the upgrade from a previous version could have populated the fields this way. this sounds strange, but i'm just fishing for possibilities now.

    all i can say for certain is that i had a previously functioning gallery where i used getImageTitle to fetch the actual file name. i don't know if that means it was fetching a copy of the file name that had been somehow copied into the title field, however. i DO know that it definitely worked, and worked whether or not i had a caption attached to the photo.

    i've solved the problem by writing some new code, but i'm still very curious about what happened.

    when you say that the object title comes from:
    IPTC Object Name
    IPTC Image Headline
    EXIF Description[sic]

    does that mean that ZP fills it in during import based on that priority?
  • follow up newbie programming question:

    trying to use Acrylian's suggestion of $_zp_current_image->filename

    currently my code looks like:
    `<?php print convert_to_filename ( getFullImageURL() ); ?>`

    how would i write this using $_zp_current_image->filename?

    obviously the following is incorrect ('cause i tried it):
    `<?php print $_zp_current_image->filename; ?>`
  • Yes, ZP does fill in the title based on that priority. Should none of these exist it uses the filename.

    What was wrong with your code above? If I understand what you want, it should be doing it.
  • acrylian Administrator, Developer
    You should use `echo` with that code snippet I posted. This of course only works if you are either in an `next_image` loop or on the image.php page itself. Otherwise no current image is set (unless you do that manually or just use an image object - see the object model tutorial maybe).
  • In answer to your question about what was wrong with the code, it simply didn't produce anything at all. But after some experimentation, I think it must be a context problem. If I put the code directly into the image.php page, it works. Ideally, however, I need to put the code in a file that is being added via an include. Is there a way to do that while maintaining context, or do I have to move all the code to the image.php page? Obviously, the latter would be a bummer since it would mean that I have to maintain duplicate code.

    EDIT: the above was written before seeing Acrylian's post. i guess i have to move the code since i'm assuming there's no way to do what i asked above. is that correct?
  • Where the code should not matter except for one specific situation. If the code is within a function definition, then the variable `$_zp_current_image` must be declared within the function as a global.

    If this was not the case, then the code should throw a PHP error. You should check your error log.
  • thanks, sbillard - that works! now i have two functions that both work. :) i think the `$_zp_current_image` method is more elegant, however. :)
Sign In or Register to comment.