How to display gallery admin's name & image copyright status on image page?

I had a rough time getting started with Zenphoto, and almost gave up on it recently, but decided to give it another shot. I'm glad I did -- this time things have gone more smoothly.

Now I'm creating a customized version of an existing theme. There are just 2 pieces of info I'd like to add to the image.php page:

- My name, as admin/owner of the site
- The image's copyright status

I'd prefer to pull these from variables rather than hard-code them into the image.php file; I'd like my theme modifications to be usable by other people.

Can anyone supply me with the code snippets that would display these 2 pieces of info?

Many thanks in advance!

Comments

  • For the first, and I'm not entirely sure on this, I don't think there is a function directly for getting the master account. If I'm not mistaken, however, you could get the list of all administrators and shift off the first one. I believe the first account is always the master account, but yet again, I'm not sure. (see http://www.zenphoto.org/documentation/functions/Zenphoto_Authority.html#methodgetAdministrators)

    For the second, there is an accessor for the `_Image` class that will retrieve the copyright field. You should be able to use `$_zp_current_image->getCopyright()`. (see http://www.zenphoto.org/documentation/classes/_Image.html#methodgetCopyright)
  • Kagutsuchi is correct in how to obtain the "master" user. However, the "master" user is an ephimeral thing. It can change. The actual definition is "The 'oldest', most priviledged user. We really do not have the concept of the site owner.

    But unless you are creating a general theme rather than one just for yourself, I would think that you could just output your name as a constant where you want it to appear.

    For the copyright, use the `printImageData('copyright');` function.
  • Thank you both for your prompt replies!

    I understand now that the concept of "site owner" is not really applicable in the case of ZP. Since there is no variable for this anywhere, I think I will just go ahead and leave my name hard-coded into the image.php file for now. I will be the only user of this ZP installation. If I want to make the theme available, I can just tell people to customize it with their own names.

    As for copyright: sbillard, I used your code and it worked perfectly.

    Thanks again...
  • My take on the name or fullname of the owner of an image or album, since I plan to have more than one user I added in themes `functions.php` this function:

    `


    function fullnameForUsername($username) {

    $quoated = db_quote($username);

    $row = query_single_row("select name from administrators where user=".$quoated.";");

    return $row['name'];

    }

    `
    And then wherever I need to display the full user name, in images.php for example, I use:

    `


    Copyright © <?php echo fullnameForUsername(getImageData('owner'));?>

    `
    Just a quick hack, a bit unnecessary to create another db connection might be.
  • acrylian Administrator, Developer
    Yes, the query is unnecessary. You should really use the object model instead.
    This gets the owner:
    `$owner = $_zp_current_image->getOwner() or $owner = $_zp_current_album->getOwner()`

    To get the real name you need to create an administrator object:
    `
    $admin = new Zenphoto_Administrator($owner,false);
    $adminname = $admin->getName()
    `
    (offhand see the documentation),
Sign In or Register to comment.