Print image comments

Hi!

When viewing my gallery i want to display my thumbnails as a list and show the comments of each item next to it.
Basically i want my gallery to have two columns one for the thumbnail other for the comments.
I have no problem changing my css/template to the desired layout i just can't find how to get the comments from each image..
using printLatestComments gets all comments from all images..
Is there other function?

Comments

  • acrylian Administrator, Developer
    You would have to use this:
    http://www.zenphoto.org/news/zenphotos-object-model-framework

    Also `getLatestComments()` has a parameter for the ID. You get the id within the image loop via said object model. Then you need to write something to out put the comments fetched.
  • Thank you, but the link you mentioned is going to a zenphoto reinstall login page.. is there any problem?

    EDIT: It's working now! Thank you!
  • acrylian Administrator, Developer
    It should now work actually. My colleague did just update the site.
  • I'm calling `getLatestComments()` in my theme's album.php.
    For testing purposes i'm just printing the comment itself.
    My code:

    `

    <?php
    foreach(getLatestComments(10,"image",$_zp_current_image-
    >getID()) as $commentID => $comment){

    print $comment["comment"];

    }
    ?>

    `
    This is throwing a Fatal error: Cannot access empty property in \zenphoto\zp-core\template-functions.php on line 3260 which is `$comment['folder'] = $img->$album->name;` but if i comment that line it works. I don't understand why $album->name is empty, it shouldn't be filled with the folder name of the gallery?
  • acrylian Administrator, Developer
    You need to make sure $_zp_current_image is set. It is only within next_image() or on image.php itself.

    You also really need to look what getLatestComments returns and if it does return something before you start the foreach loop. Also best don't put the function into foreach itself for that reason. That will throw errors if nothing is returned as well otherwise.

    $album->name is empty because the album object is not setup. On album php. $_zp_current_album is available and also within the next_album loop.
  • $zp_current_image is set i'm executing the code within next_image(). $_zp_current_album is set and i'm also in album.php.
    What i have to do to setup the album object? Do i need to do it inside album.php?
  • Hi, i'm digging around this, shouldn't $comment['folder'] = $img->$album->name; on line 3260 of template-functions.php be $comment['folder'] = $img->album->name;? The album object is perfectly set.
  • acrylian Administrator, Developer
    I cannot answer at the moment, we will have to look later at it.
  • Ok acrylian, thank you!
  • @jalves:

    Indeed, if that line did read as you quote it would be wrong. But nothing near that line resembles your statement in the current builds. Nor does the line appear anywhere else that I can find.

    So the suggestion would be to be sure you are running current code.
  • Hi!
    i was running zenphoto 1.4.4.1 just did an upgrade to 1.4.4.3 and the problem is solved.
    It was indeed that line.
    Thank you.
Sign In or Register to comment.