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 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)
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.
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...
`
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.
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),