I could not find any mention of Pinterest on the forum or user guide, so I supposed there was no "pin it" button for Zenphoto and embarked into making one.
Here is what I have done so far:
`
<?php
function getFullPageURL() {
$pageURL = '
http://' . $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
return $pageURL;
}
?>
<?php
function getWebsiteRootURL() {
$rootURL = '
http://' . $_SERVER["SERVER_NAME"];
return $rootURL;
}
?>
&media=<?php echo urlencode(getWebsiteRootURL()); echo urlencode(getFullImageURL( )); ?>&description=<?php printImageTitle(); ?>" class="pin-it-button" count-layout="horizontal">`
I created a custom function to return the full URL of the current page and another one to return the website root URL as I found no equivalents in Zenphoto.
Do they exist?
I still have a little problem:
I would like to mention the author in the description. As I found no author field for an image, I planned to use the copyright metadata.
Unfortunately the getCopyright() function returns an error when used on an image page.
How can I display the contents of this field?
Thanks in advance for any hints.
Comments
Image/albums don't have an author but an owner which is rights management releated. So the metadata field is the right one to use.
Zenphoto has functions for everything actually. You will need to look at the object model (getCopyright is a image class method not a standalone function). There is a tutorial on the user guide. We have several cosntants like WEBPATH or FULLWEBPATH for the "full" url.
`GetCopyright()` is a method of the image object. Since you do not quote the error, this is about the best help I can be.
[edit] I see acrylian has answered while I was typing.
Other metadata fields to consider are: `artist`, `byline`, or `copyright holder` depending on the custom.
My addthis buttons and pinit button are on 2 seperate lines on my webpage.
how can I get the pinit button to display on the same line as the addthis?
<?php printaddthis() ?>
<?php
function getFullPageURL() {
$pageURL = 'http://' . $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
return $pageURL;
}
?>
<?php
function getWebsiteRootURL() {
$rootURL = 'http://' . $_SERVER["SERVER_NAME"];
return $rootURL;
}
?>
&media=<?php echo urlencode(getWebsiteRootURL()); echo urlencode(getFullImageURL( )); ?>&description=<?php printImageTitle(); ?>" class="pin-it-button" count-layout="horizontal"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" />
<?php include ('inc_header.php'); ?>
<div class="main">
<div class="content-image">
<div id="breadcrumb">
<div class="img-nav">
<?php if (hasPrevImage()) { ?>
<div class="img-previous">" title="<?php echo gettext('Previous Image'); ?>"><</div>
<?php } else { ?>
<div class="img-previous disabledlink"><</div>
<?php } ?>
<?php if (hasNextImage()) { ?>
<div class="img-next">" title="<?php echo gettext('Next Image'); ?>">></div>
<?php } else { ?>
<div class="img-next disabledlink">></div>
<?php } ?>
</div>
<h2>
<?php printHomeLink('', ' » '); ?>
" title="<?php echo gettext('Main Index'); ?>"><?php echo gettext('Home'); ?> »
<?php if ((gettext(getOption('ifeeldirty_homepage')) == gettext('none')) && (!getOption('ifeeldirty_news_on_homepage'))) { ?>
" title="<?php echo gettext('Albums Index'); ?>"><?php echo html_encode(getGalleryTitle()); ?>
<?php } else { ?>
<?php printCustomPageURL(getGalleryTitle(), 'gallery'); ?>
<?php } ?>
» <?php printParentBreadcrumb('', ' » ', ' » '); ?><?php printAlbumBreadcrumb('', ' » '); ?><?php printImageTitle(true); ?>
</h2>
</div>
<?php if (function_exists('printSlideShowLink')) { ?>
<div class="img-slide clearfix">
<?php printSlideShowLink(gettext('Slideshow')); ?>
</div>
<?php } ?>
<div id="image">
<?php if (getOption('use_colorbox_image')) { ?>
<?php /* to do : display full image or sized image */ ?>
" title="<?php echo getBareImageTitle(); ?>"><?php printDefaultSizedImage(getImageTitle()); ?>
<?php } else { ?>
<?php printDefaultSizedImage(getImageTitle()); ?>
<?php } ?>
</div>
<div id="image-title"><?php printImageTitle(true); ?></div>
<div id="image-infos"><?php printImageDesc(true); ?></div>
<p align="center"><?php printaddthis() ?>
<p align="center"><?php
function getFullPageURL() {
$pageURL = 'http://' . $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
return $pageURL;
}
?>
<?php
function getWebsiteRootURL() {
$rootURL = 'http://' . $_SERVER["SERVER_NAME"];
return $rootURL;
}
?>
&media=<?php echo urlencode(getWebsiteRootURL()); echo urlencode(getFullImageURL( )); ?>&description=<?php printImageTitle(); ?>" class="pin-it-button" count-layout="horizontal"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" />
<?php if ((getOption('show_exif')) && (getImageMetaData())) { ?>
<div id="exif_link">" class="colorbox"><?php echo gettext('Image Info'); ?></div>
<div style='display:none'><?php printImageMetadata('', false); ?></div>
<?php } ?>
<div class="tags">
<?php printTags('links', NULL, 'taglist', ''); ?>
<div class="clearfix"></div>
</div>
<?php if (function_exists('printRating')) { ?>
<div class="rating"><?php printRating(); ?></div>
<?php } ?>
<?php if (function_exists('printGoogleMap')) { ?>
<div class="googlemap"><?php printGoogleMap(NULL, 'googlemap'); ?></div>
<?php } ?>
<?php include('inc_print_comment.php'); ?>
</div> <!-- content -->
<div class="clearfix"></div>
</div> <!-- main -->
<?php include('inc_footer.php'); ?>
Btw, please learn how to escape code correctly. Use `backticks`.