function edit_crop_image($output, $image, $prefix, $subpage, $tagsort) { $album = $image->getAlbum(); $albumname = $album->name; $imagename = $image->filename; if (isImagePhoto($image)) { $output .= '<p class="buttons" >' . "\n" . '<a href="' . WEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER . '/crop_image.php?a=' . pathurlencode($albumname) . "\n" . '&i=' . urlencode($imagename) . '&performcrop=backend&subpage=' . $subpage . '&tagsort=' . $tagsort . '">' . "\n" . '<img src="images/shape_handles.png" alt="" />' . gettext("Crop image") . '</a>' . "\n" . '</p>' . "\n" . '<span style="line-height: 0em;"><br clear="all" /></span>' . "\n"; } return $output; }
static function edit($output, $image, $prefix, $subpage, $tagsort) { if (isImagePhoto($image)) { if (is_array($image->filename)) { $albumname = dirname($image->filename['source']); $imagename = basename($image->filename['source']); } else { $albumname = $image->albumlink; $imagename = $image->filename; } $output .= '<div class="button buttons tooltip" title="' . gettext('Permanently crop the actual image.') . '">' . "\n" . '<a href="' . WEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER . '/crop_image.php?a=' . pathurlencode($albumname) . "\n" . '&i=' . urlencode($imagename) . '&performcrop=backend&subpage=' . $subpage . '&tagsort=' . html_encode($tagsort) . '">' . "\n" . '<img src="images/shape_handles.png" alt="" />' . gettext("Crop image") . '</a>' . "\n" . '<br class="clearall" />' . '</div>' . "\n"; } return $output; }
function theme_content($map) { global $_zp_current_image, $points; ?> <!-- Colorbox section --> <div id="images"> <?php $points = array(); while (next_image()) { if ($map) { $coord = getGeoCoord($_zp_current_image); if ($coord) { $points[] = $coord; } } ?> <div class="image"> <div class="imagethumb"> <?php if (isImagePhoto()) { // colorbox is only for real images $link = html_encode(getDefaultSizedImage()) . '" class="thickbox"'; } else { $link = html_encode(getImageURL()) . '"'; } ?> <a href="<?php echo $link; ?> " title="<?php echo getBareImageTitle(); ?> "> <?php printImageThumb(getImageTitle()); ?> </a></div> </div> <?php } ?> </div> <br class="clearall" /> <?php @call_user_func('printSlideShowLink'); }
function loadAlbum($album) { global $gallery, $_zp_current_album, $_zp_current_image; $subalbums = $album->getSubAlbums(); $count = 0; foreach ($subalbums as $folder) { $subalbum = new Album($gallery, $folder); $count = $count + loadAlbum($subalbum); } $_zp_current_album = $album; if (getNumImages() > 0) { echo "<br />" . $album->name . "{"; while (next_image(true)) { if (isImagePhoto($_zp_current_image)) { echo '<img src="' . getImageThumb() . '" height="8" width="8" /> | <img src="' . getDefaultSizedImage() . '" height="20" width="20" />' . "\n"; } else { echo '<img src="' . getImageThumb() . '" height="8" width="8" /> | '; } $count++; } echo "}<br/>\n"; } return $count; }
?> &tagsort=<?php echo html_encode($tagsort); ?> &XSRFToken=<?php echo getXSRFToken('imagemetadata'); ?> " > <img src="images/cache.png" alt="" /><?php echo gettext("Refresh Metadata"); ?> </a> <br class="clearall" /> </div> <?php if (isImagePhoto($image) || !is_null($image->objectsThumb)) { ?> <div class="button buttons tooltip" title="<?php printf(gettext('crop %s'), $image->filename); ?> "> <a href="admin-thumbcrop.php?a=<?php echo html_encode(pathurlencode($album->name)); ?> &i=<?php echo urlencode($image->filename); ?> &subpage=<?php echo $pagenum; ?> &tagsort=<?php
/** * Gets the content of a news article * * If using the CombiNews feature this returns the description for gallery items (see printNewsContent for more) * * @param int $shorten The optional length of the content for the news list for example, will override the plugin option setting if set, "" (empty) for full content (not used for image descriptions!) * @param string $shortenindicator The placeholder to mark the shortening (e.g."(...)"). If empty the Zenpage option for this is used. * @param string $readmore The text for the "read more" link. If empty the term set in Zenpage option is used. * * @return string */ function getNewsContent($shorten = false, $shortenindicator = NULL, $readmore = NULL) { global $_zp_flash_player, $_zp_current_image, $_zp_gallery, $_zp_current_zenpage_news, $_zp_page; $newstype = getNewsType(); switch ($newstype) { case 'news': if (!$_zp_current_zenpage_news->checkAccess()) { return '<p>' . gettext('<em>This article belongs to a protected category.</em>') . '</p>'; } break; case 'image': $album = getNewsAlbumName(); $albumobj = new Album($_zp_gallery, $album); if (!$albumobj->checkAccess()) { return '<p>' . gettext('<em>This entry belongs to a protected album.</em>') . '</p>'; } break; case 'album': if (!$_zp_current_zenpage_news->checkAccess()) { return '<p>' . gettext('<em>This entry belongs to a protected album.</em>') . '</p>'; } break; } $excerptbreak = false; if (!$shorten && !is_NewsArticle()) { $shorten = ZP_SHORTEN_LENGTH; } $articlecontent = ""; $size = ZP_CN_IMAGESIZE; $width = ZP_CN_THUMBWIDTH; $height = ZP_CN_THUMBHEIGHT; $cropwidth = ZP_CN_CROPWIDTH; $cropheight = ZP_CN_CROPHEIGHT; $cropx = ZP_CN_CROPX; $cropy = ZP_CN_CROPY; $mode = ZP_CN_MODE; switch ($newstype) { case 'news': $articlecontent = $_zp_current_zenpage_news->getContent(); if (!is_NewsArticle()) { $articlecontent = getContentShorten($articlecontent, $shorten, $shortenindicator, $readmore, getNewsURL($_zp_current_zenpage_news->getTitlelink())); } break; case 'image': switch ($mode) { case 'latestimages-sizedimage': if (isImagePhoto($_zp_current_zenpage_news)) { $articlecontent = '<a href="' . html_encode($_zp_current_zenpage_news->getImageLink()) . '" title="' . html_encode($_zp_current_zenpage_news->getTitle()) . '">'; $articlecontent .= '<img src="' . html_encode($_zp_current_zenpage_news->getSizedImage($size)) . '" alt="' . html_encode($_zp_current_zenpage_news->getTitle()) . '" />'; $articlecontent .= '</a>'; } else { if (isImageVideo($_zp_current_zenpage_news)) { $articlecontent .= $_zp_current_zenpage_news->getSizedImage($size); } else { $articlecontent = '<a href="' . html_encode($_zp_current_zenpage_news->getImageLink()) . '" title="' . html_encode($_zp_current_zenpage_news->getTitle()) . '">'; $articlecontent .= '<img src="' . html_encode($_zp_current_zenpage_news->getCustomImage($size, NULL, NULL, NULL, NULL, NULL, NULL, true)) . '" alt="' . html_encode($_zp_current_zenpage_news->getTitle()) . '" />'; $articlecontent .= '</a>'; } } break; case 'latestimages-thumbnail': $articlecontent = '<a href="' . html_encode($_zp_current_zenpage_news->getImageLink()) . '" title="' . html_encode($_zp_current_zenpage_news->getTitle()) . '"><img src="' . html_encode($_zp_current_zenpage_news->getThumb()) . '" alt="' . html_encode($_zp_current_zenpage_news->getTitle()) . '" /></a>'; break; case 'latestimages-thumbnail-customcrop': if (isImagePhoto($_zp_current_zenpage_news)) { $articlecontent = '<a href="' . html_encode($_zp_current_zenpage_news->getImageLink()) . '" title="' . html_encode($_zp_current_zenpage_news->getTitle()) . '"><img src="' . html_encode($_zp_current_zenpage_news->getCustomImage(NULL, $width, $height, $cropwidth, $cropheight, $cropx, $cropy)) . '" alt="' . html_encode($_zp_current_zenpage_news->getTitle()) . '" /></a>'; } else { $articlecontent = '<a href="' . html_encode($_zp_current_zenpage_news->getImageLink()) . '" title="' . html_encode($_zp_current_zenpage_news->getTitle()) . '"><img src="' . html_encode($_zp_current_zenpage_news->getCustomImage(NULL, $width, $height, $cropwidth, $cropheight, $cropx, $cropy, true)) . '" alt="' . html_encode($_zp_current_zenpage_news->getTitle()) . '" /></a>'; } break; } $articlecontent .= getContentShorten($_zp_current_zenpage_news->getDesc(), $shorten, $shortenindicator, $readmore, $_zp_current_zenpage_news->getImageLink()); break; case 'video': $articlecontent = getNewsVideoContent($_zp_current_zenpage_news, $shorten); break; case 'album': $_zp_page = 1; $albumdesc = getContentShorten($_zp_current_zenpage_news->getDesc(), $shorten, $shortenindicator, $readmore, $_zp_current_zenpage_news->getAlbumLink()); $albumthumbobj = $_zp_current_zenpage_news->getAlbumThumbImage(); switch ($mode) { case 'latestalbums-sizedimage': if (isImagePhoto($albumthumbobj)) { $imgurl = html_encode($albumthumbobj->getSizedImage($size)); } else { $imgurl = html_encode($albumthumbobj->getCustomImage($size, NULL, NULL, NULL, NULL, NULL, NULL, true)); } $articlecontent = '<a href="' . html_encode($_zp_current_zenpage_news->getAlbumLink()) . '" title="' . html_encode($_zp_current_zenpage_news->getTitle()) . '"><img src="' . $imgurl . '" alt="' . html_encode($_zp_current_zenpage_news->getTitle()) . '" /></a>' . $albumdesc; break; case 'latestalbums-thumbnail': $articlecontent = '<a href="' . html_encode($_zp_current_zenpage_news->getAlbumLink()) . '" title="' . html_encode($_zp_current_zenpage_news->getTitle()) . '"><img src="' . html_encode($_zp_current_zenpage_news->getAlbumThumb()) . '" alt="' . html_encode($_zp_current_zenpage_news->getTitle()) . '" /></a>' . $albumdesc; break; case 'latestalbums-thumbnail-customcrop': $articlecontent = '<a href="' . html_encode($_zp_current_zenpage_news->getAlbumLink()) . '" title="' . html_encode($_zp_current_zenpage_news->getTitle()) . '"><img src="' . html_encode($albumthumbobj->getCustomImage(NULL, $width, $height, $cropwidth, $cropheight, $cropx, $cropy, true)) . '" alt="' . html_encode($_zp_current_zenpage_news->getTitle()) . '" /></a>' . $albumdesc; break; case 'latestimagesbyalbum-thumbnail': case 'latestimagesbyalbum-thumbnail-customcrop': case 'latestimagesbyalbum-sizedimage': $images = query_full_array("SELECT title, filename FROM " . prefix('images') . " AS images WHERE date LIKE '" . $_zp_current_zenpage_news->getDateTime() . "%' AND albumid = " . $_zp_current_zenpage_news->id . " ORDER BY date DESC"); foreach ($images as $image) { $imageobj = newImage($_zp_current_zenpage_news, $image['filename']); if (getOption('combinews-latestimagesbyalbum-imgdesc')) { $imagedesc = $imageobj->getDesc(); $imagedesc = getContentShorten($imagedesc, $shorten, $shortenindicator, $readmore, $imageobj->getImageLink()); } else { $imagedesc = ''; } $articlecontent .= '<div class="latestimagesbyalbum">'; // entry wrapper switch ($mode) { case 'latestimagesbyalbum-thumbnail': if (getOption('combinews-latestimagesbyalbum-imgtitle')) { $articlecontent .= '<h4>' . html_encode($imageobj->getTitle()) . '</h4>'; } $articlecontent .= '<a href="' . html_encode($imageobj->getImageLink()) . '" title="' . html_encode($imageobj->getTitle()) . '"><img src="' . html_encode($imageobj->getThumb()) . '" alt="' . html_encode($imageobj->getTitle()) . '" /></a>' . $imagedesc; break; case 'latestimagesbyalbum-thumbnail-customcrop': if (getOption('combinews-latestimagesbyalbum-imgtitle')) { $articlecontent .= '<h4>' . html_encode($imageobj->getTitle()) . '</h4>'; } if (isImagePhoto($imageobj)) { $articlecontent .= '<a href="' . html_encode($imageobj->getImageLink()) . '" title="' . html_encode($imageobj->getTitle()) . '"><img src="' . html_encode($imageobj->getCustomImage(NULL, $width, $height, $cropwidth, $cropheight, $cropx, $cropy)) . '" alt="' . html_encode($imageobj->getTitle()) . '" /></a>' . $imagedesc; } else { if (isImageVideo($imageobj)) { $articlecontent .= getNewsVideoContent($imageobj) . $imagedesc; } else { $articlecontent .= '<a href="' . html_encode($imageobj->getImageLink()) . '" title="' . html_encode($imageobj->getTitle()) . '"><img src="' . html_encode($imageobj->getCustomImage(NULL, $width, $height, $cropwidth, $cropheight, $cropx, $cropy, true)) . '" alt="' . html_encode($imageobj->getTitle()) . '" /></a>' . $imagedesc; } } break; case 'latestimagesbyalbum-sizedimage': if (getOption('combinews-latestimagesbyalbum-imgtitle')) { $articlecontent .= '<h4>' . html_encode($imageobj->getTitle()) . '</h4>'; } if (isImagePhoto($imageobj)) { $articlecontent .= '<a href="' . html_encode($imageobj->getImageLink()) . '" title="' . html_encode($imageobj->getTitle()) . '"><img src="' . pathurlencode($imageobj->getSizedImage($size)) . '" alt="' . html_encode($imageobj->getTitle()) . '" /></a>' . $imagedesc; } else { if (isImageVideo($imageobj)) { $articlecontent .= getNewsVideoContent($imageobj) . $imagedesc; } else { $articlecontent .= '<a href="' . html_encode($imageobj->getImageLink()) . '" title="' . html_encode($imageobj->getTitle()) . '"><img src="' . html_encode($imageobj->getCustomImage($size, NULL, NULL, NULL, NULL, NULL, NULL, true)) . '" alt="' . html_encode($imageobj->getTitle()) . '" /></a>' . $imagedesc; } } break; } // switch "latest images by album end" $articlecontent .= '</div>'; // entry wrapper end } // foreach end break; } // switch "albums mode end" } // main switch end return $articlecontent; }
function theme_content($map) { global $_zp_current_image, $points; ?> <!-- Colorbox section --> <div id="content"> <div id="main"> <div id="images"> <?php $points = array(); $firstImage = null; $lastImage = null; while (next_image()) { // Colorbox does not do video if (is_null($firstImage)) { $lastImage = imageNumber(); $firstImage = $lastImage; } else { $lastImage++; } ?> <div class="image"> <div class="imagethumb"> <?php if ($map) { $coord = getGeoCoord($_zp_current_image); if ($coord) { $points[] = $coord; } } $annotate = annotateImage(); if (isImagePhoto()) { // colorbox is only for real images echo '<a href="' . html_encode(getDefaultSizedImage()) . '" class="thickbox"'; } else { echo '<a href="' . html_encode(getImageURL()) . '"'; } echo " title=\"" . $annotate . "\">\n"; printImageThumb($annotate); echo "</a>"; ?> </div> </div> <?php } echo '<div class="clearage"></div>'; if (!empty($points) && $map) { function map_callback($map) { global $points; foreach ($points as $coord) { addGeoCoord($map, $coord); } } ?> <div id="map_link"> <?php printGoogleMap(NULL, NULL, NULL, 'album_page', 'map_callback'); ?> </div> <?php } @call_user_func('printSlideShowLink', NULL, 'text-align:center;'); ?> </div><!-- images --> <?php @call_user_func('printRating'); ?> </div><!-- main --> <div class="clearage"></div> <?php if (isset($firstImage)) { printNofM('Photo', $firstImage, $lastImage, getNumImages()); } ?> </div><!-- content --> <?php }
/** * Print normal video or custom sized images. * Note: a class of 'not_visible' or 'password_protected' will be added as appropriate * * Notes on cropping: * * The $crop* parameters determine the portion of the original image that will be incorporated * into the final image. The w and h "sizes" are typically proportional. That is you can set them to * values that reflect the ratio of width to height that you want for the final image. Typically * you would set them to the fincal height and width. * * @param string $alt Alt text for the url * @param int $size size * @param int $width width * @param int $height height * @param int $cropw crop width * @param int $croph crop height * @param int $cropx crop x axis * @param int $cropy crop y axis * @param string $class Optional style class * @param string $id Optional style id * @param bool $thumbStandin set to true to treat as thumbnail * @param bool $effects image effects (e.g. set gray to force grayscale) * */ function printCustomSizedImage($alt, $size, $width = NULL, $height = NULL, $cropw = NULL, $croph = NULL, $cropx = NULL, $cropy = NULL, $class = NULL, $id = NULL, $thumbStandin = false, $effects = NULL) { global $_zp_current_image; if (is_null($_zp_current_image)) { return; } if (!$_zp_current_image->getShow()) { $class .= " not_visible"; } $album = $_zp_current_image->getAlbum(); $pwd = $album->getPassword(); if (!empty($pwd)) { $class .= " password_protected"; } if ($size) { $dims = getSizeCustomImage($size); $sizing = ' width="' . $dims[0] . '" height="' . $dims[1] . '"'; } else { $sizing = ''; if ($width) { $sizing .= ' width="' . $width . '"'; } if ($height) { $sizing .= ' height="' . $height . '"'; } } if ($id) { $id = ' id="' . $id . '"'; } if ($class) { $id .= ' class="' . $class . '"'; } if (isImagePhoto() || $thumbStandin) { $html = '<img src="' . html_encode(getCustomImageURL($size, $width, $height, $cropw, $croph, $cropx, $cropy, $thumbStandin, $effects)) . '"' . ' alt="' . html_encode($alt) . '"' . $id . $sizing . ' />'; $html = zp_apply_filter('custom_image_html', $html, $thumbStandin); echo $html; } else { // better be a plugin echo $_zp_current_image->getBody($width, $height); } }
/** * * performs a query and then filters out "illegal" images returning the first "good" image * used by the random image functions. * * @param object $result query result * @param string $source album object if this is search within the album */ function filterImageQuery($result, $source) { if ($result) { while ($row = db_fetch_assoc($result)) { $image = newImage(null, $row); $album = $image->album; if ($album->name == $source || $album->checkAccess()) { if (isImagePhoto($image)) { if ($image->checkAccess()) { return $image; } } } } db_free_result($result); } return NULL; }
if (hasNextImage()) { ?> <a href="<?php echo htmlspecialchars(getNextImageURL()); ?> ">Next</a><?php } else { ?> <span>Next</span><?php } ?> </li> </ul> </div> <?php if (isImagePhoto() && extensionEnabled('colorbox_js') && zp_has_filter('theme_head', 'colorbox::css')) { $imgURL = getFullImageURL(); $boxclass = " class=\"fullimage\""; $cb = true; } else { $cb = false; } ?> <div id="content" class="c"> <div class="view c"> <?php if ($cb == true) { ?> <a href="<?php echo html_encode($imgURL); ?>
?> /admin-edit.php?page=edit&album=<?php echo pathurlencode($album->name); ?> &image=<?php echo urlencode($image->filename); ?> &tab=imageinfo#IT" title="<?php echo gettext('edit'); ?> "><img src="<?php echo WEBPATH . '/' . ZENFOLDER; ?> /images/pencil.png" alt=""></a> <?php if (isImagePhoto($image)) { ?> <a href="<?php echo html_encode(pathurlencode($image->getFullImageURL())); ?> " class="colorbox" title="zoom"><img src="<?php echo WEBPATH . '/' . ZENFOLDER; ?> /images/magnify.png" alt=""></a> <?php } ?> </p> <?php } ?>
?> " title="<?php echo html_encode($obj->getTitle()); ?> "> <img src="<?php echo html_encode(pathurlencode($thumburl)); ?> " alt="<?php echo html_encode($obj->getTitle()); ?> " /> </a> <div class="caption caption-image"> <?php if (isImagePhoto($obj)) { ?> <a class="swipebox image-zoom" title="<?php echo html_encode('<a href="' . $obj->getLink() . '">' . $obj->getTitle() . '</a>'); ?> " href="<?php echo html_encode($obj->getSizedImage(getOption('image_size'))); ?> "><i class="fa fa-search-plus fa-lg"></i></a> <?php } ?> <?php if (function_exists('getCommentCount')) { if ($obj->getCommentsAllowed() && $obj->getCommentCount() > 0) { ?>
?> /js/rememberMe.js"></script> <script type="text/javascript" src="<?php echo $_zp_themeroot; ?> /js/comments.js"></script> <script type="text/javascript" src="<?php echo FULLWEBPATH . "/" . ZENFOLDER; ?> /js/thickbox.js"></script> <?php printRSSHeaderLink('Gallery', 'Gallery RSS'); setOption('thumb_crop_width', 85, false); setOption('thumb_crop_height', 85, false); setOption('images_per_page', getOption('images_per_page') - 1, false); if (!isImagePhoto($_zp_current_image)) { echo '<style type="text/css"> #prevnext a strong {display:none;}</style>'; } ?> </head> <body class="photosolo"> <?php echo getGalleryTitle(); if (getOption('Allow_search')) { printSearchForm(); } ?> <div id="content" class="v">
function loadAlbum($album) { global $_zp_current_album, $_zp_current_image, $_zp_gallery, $custom, $enabled; $subalbums = $album->getAlbums(); $started = false; $tcount = $count = 0; foreach ($subalbums as $folder) { $subalbum = newAlbum($folder); if (!$subalbum->isDynamic()) { $tcount = $tcount + loadAlbum($subalbum); } } $theme = $_zp_gallery->getCurrentTheme(); $id = 0; $parent = getUrAlbum($album); $albumtheme = $parent->getAlbumTheme(); if (!empty($albumtheme)) { $theme = $albumtheme; $id = $parent->getID(); } loadLocalOptions($id, $theme); $_zp_current_album = $album; if ($album->getNumImages() > 0) { echo "<br />" . $album->name . ' '; while (next_image(true)) { if (isImagePhoto($_zp_current_image)) { $countit = 0; if (in_array('*', $enabled)) { $uri = getFullImageURL(NULL, 'Protected view'); if (strpos($uri, 'full-image.php?') !== false) { if (!($count + $countit)) { echo "{ "; } else { echo ' | '; } $countit = 1; ?> <a href="<?php echo html_encode($uri); ?> &debug"> <?php echo '<img src="' . html_encode(pathurlencode($uri)) . '" height="30" width="30" alt="X" />' . "\n"; ?> </a> <?php } } foreach ($custom as $key => $cacheimage) { if (in_array($key, $enabled)) { $size = isset($cacheimage['image_size']) ? $cacheimage['image_size'] : NULL; $width = isset($cacheimage['image_width']) ? $cacheimage['image_width'] : NULL; $height = isset($cacheimage['image_height']) ? $cacheimage['image_height'] : NULL; $thumbstandin = isset($cacheimage['thumb']) ? $cacheimage['thumb'] : NULL; if ($special = $thumbstandin === true) { list($special, $cw, $ch, $cx, $cy) = $_zp_current_image->getThumbCropping($size, $width, $height); } if (!$special) { $cw = isset($cacheimage['crop_width']) ? $cacheimage['crop_width'] : NULL; $ch = isset($cacheimage['crop_height']) ? $cacheimage['crop_height'] : NULL; $cx = isset($cacheimage['crop_x']) ? $cacheimage['crop_x'] : NULL; $cy = isset($cacheimage['crop_y']) ? $cacheimage['crop_y'] : NULL; } $effects = isset($cacheimage['gray']) ? $cacheimage['gray'] : NULL; if (isset($cacheimage['wmk'])) { $passedWM = $cacheimage['wmk']; } else { if ($thumbstandin) { $passedWM = getWatermarkParam($_zp_current_image, WATERMARK_THUMB); } else { $passedWM = getWatermarkParam($_zp_current_image, WATERMARK_IMAGE); } } if (isset($cacheimage['maxspace'])) { getMaxSpaceContainer($width, $height, $_zp_current_image, $thumbstandin); } $args = array($size, $width, $height, $cw, $ch, $cx, $cy, NULL, $thumbstandin, NULL, $thumbstandin, $passedWM, NULL, $effects); $args = getImageParameters($args, $album->name); $uri = getImageURI($args, $album->name, $_zp_current_image->filename, $_zp_current_image->filemtime); if (strpos($uri, 'i.php?') !== false) { if (!($count + $countit)) { echo "{ "; } else { echo ' | '; } $countit = 1; ?> <a href="<?php echo html_encode($uri); ?> &debug"> <?php if ($thumbstandin) { echo '<img src="' . html_encode(pathurlencode($uri)) . '" height="15" width="15" alt="x" />' . "\n"; } else { echo '<img src="' . html_encode(pathurlencode($uri)) . '" height="20" width="20" alt="X" />' . "\n"; } ?> </a> <?php } } } $count = $count + $countit; } } if ($count) { echo ' } '; } printf(ngettext('[%u image]', '[%u images]', $count), $count); echo "<br />\n"; } return $count + $tcount; }
/** * A helper function that only prints a item of the loop within printAlbumStatistic() * Not for standalone use. * * @param array $album the array with album objects that getAlbumsStatistic() submitted * @param string $option * "popular" for the most popular albums, * "latest" for the latest uploaded by id (Discovery) * "latest-date" for the latest by date * "latest-mtime" for the latest by mtime * "latest-publishdate" for the latest by publishdate * "mostrated" for the most voted, * "toprated" for the best voted * "latestupdated" for the latest updated * "random" for random order (yes, strictly no statistical order...) * @param bool $showtitle if the album title should be shown * @param bool $showdate if the album date should be shown * @param bool $showdesc if the album description should be shown * @param integer $desclength the length of the description to be shown * @param string $showstatistic * "hitcounter" for showing the hitcounter (views), * "rating" for rating, * "rating+hitcounter" for both. * @param integer $width the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px) * @param integer $height the height/cropheight of the thumb if crop=true else not used. (Default 85px) * @param bool $crop 'true' (default) if the thumb should be cropped, 'false' if not * @param bool $firstimglink 'false' (default) if the album thumb link should lead to the album page, 'true' if to the first image of theh album if the album itself has images * @param bool $collection only if $albumfolder is set: true if you want to get statistics to include all subalbum levels */ function printAlbumStatisticItem($album, $option, $showtitle = false, $showdate = false, $showdesc = false, $desclength = 40, $showstatistic = '', $width = NULL, $height = NULL, $crop = NULL, $firstimglink = false) { global $_zp_gallery; $twidth = $width; $theight = $height; if (is_null($crop) && is_null($width) && is_null($height)) { $crop = 2; } else { if (is_null($width)) { $width = 85; } if (is_null($height)) { $height = 85; } if (is_null($crop)) { $crop = 1; } else { $crop = (int) $crop && true; } } $tempalbum = $album; if ($firstimglink && ($tempimage = $tempalbum->getImage(0))) { $albumpath = $tempimage->getLink(); } else { $albumpath = $tempalbum->getLink(); } echo "<li><a href=\"" . $albumpath . "\" title=\"" . html_encode($tempalbum->getTitle()) . "\">\n"; $albumthumb = $tempalbum->getAlbumThumbImage(); switch ($crop) { case 0: $sizes = getSizeCustomImage($width, NULL, NULL, NULL, NULL, NULL, NULL, $albumthumb); echo '<img src="' . html_encode(pathurlencode($albumthumb->getCustomImage($width, NULL, NULL, NULL, NULL, NULL, NULL, TRUE))) . '" width="' . $sizes[0] . '" height="' . $sizes[1] . '" alt="' . html_encode($albumthumb->getTitle()) . '" /></a>' . "\n"; break; case 1: if (isImagePhoto($albumthumb)) { $sizes = getSizeCustomImage(NULL, $width, $height, $width, $height, NULL, NULL, $albumthumb); } else { $sizes[0] = $width; $sizes[1] = $height; } echo '<img src="' . html_encode(pathurlencode($albumthumb->getCustomImage(NULL, $width, $height, $width, $height, NULL, NULL, TRUE))) . '" width="' . $sizes[0] . '" height="' . $sizes[1] . '" alt="' . html_encode($albumthumb->getTitle()) . '" /></a>' . "\n"; break; case 2: $sizes = getSizeDefaultThumb($albumthumb); echo '<img src="' . html_encode(pathurlencode($albumthumb->getThumb())) . '" width="' . $sizes[0] . '" height="' . $sizes[1] . '" alt="' . html_encode($albumthumb->getTitle()) . '" /></a>' . "\n"; break; } if ($showtitle) { echo "<h3><a href=\"" . $albumpath . "\" title=\"" . html_encode($tempalbum->getTitle()) . "\">\n"; echo $tempalbum->getTitle() . "</a></h3>\n"; } if ($showdate) { if ($option === "latestupdated") { $filechangedate = filectime(ALBUM_FOLDER_SERVERPATH . internalToFilesystem($tempalbum->name)); $latestimage = query_single_row("SELECT mtime FROM " . prefix('images') . " WHERE albumid = " . $tempalbum->getID() . " AND `show` = 1 ORDER BY id DESC"); $count = db_count('images', "WHERE albumid = " . $tempalbum->getID() . " AND mtime = " . $latestimage['mtime']); echo "<p>" . sprintf(gettext("Last update: %s"), zpFormattedDate(DATE_FORMAT, $filechangedate)) . "</p>"; if ($count <= 1) { $image = gettext("image"); } else { $image = gettext("images"); } echo "<span>" . sprintf(gettext('%1$u new %2$s'), $count, $image) . "</span>"; } else { echo "<p>" . zpFormattedDate(DATE_FORMAT, strtotime($tempalbum->getDateTime())) . "</p>"; } } if ($showstatistic === "rating" or $showstatistic === "rating+hitcounter") { $votes = $tempalbum->get("total_votes"); $value = $tempalbum->get("total_value"); if ($votes != 0) { $rating = round($value / $votes, 1); } echo "<p>" . sprintf(gettext('Rating: %1$u (Votes: %2$u)'), $rating, $tempalbum->get("total_votes")) . "</p>"; } if ($showstatistic === "hitcounter" or $showstatistic === "rating+hitcounter") { $hitcounter = $tempalbum->getHitcounter(); if (empty($hitcounter)) { $hitcounter = "0"; } echo "<p>" . sprintf(gettext("Views: %u"), $hitcounter) . "</p>"; } if ($showdesc) { echo shortenContent($tempalbum->getDesc(), $desclength, ' (...)'); } echo "</li>"; }
function theme_content($map) { global $_zp_current_image, $points; if (isImagePage()) { ?> <!-- Gallery section --> <div id="images"> <?php $points = array(); $firstImage = null; $lastImage = null; if (getNumImages() > 0) { ?> <div id="gallery" class="ad-gallery"> <div class="ad-image-wrapper"></div> <div class="ad-controls"></div> <div class="ad-nav"> <div class="ad-thumbs"> <ul class="ad-thumb-list"> <?php while (next_image(true)) { if ($map) { $coord = getGeoCoord($_zp_current_image); if ($coord) { $points[] = $coord; } } if (isImagePhoto()) { // does not do video if (is_null($firstImage)) { $lastImage = imageNumber(); $firstImage = $lastImage; } else { $lastImage++; } ?> <li> <a href="<?php echo html_encode(getDefaultSizedImage()); ?> "> <img src="<?php echo html_encode(pathurlencode(getImageThumb())); ?> " class="image<?php echo $lastImage; ?> " alt="<?php echo html_encode(getImageDesc()); ?> "> </a> </li> <?php } } ?> </ul> </div> </div> </div> <?php } ?> <div id="caption"<?php if (getOption('garland_caption_location') == 'none') { echo ' style="display:none"'; } ?> > </div> <div class="clearage"></div> </div><!-- images --> <br class="clearall" /> <?php } }
function theme_content($map) { global $_zp_current_image, $_zp_current_album, $points; if (isImagePage()) { ?> <!-- Gallery section --> <div id="content"> <div id="main"> <div id="images"> <?php $points = array(); $firstImage = null; $lastImage = null; if (getNumImages() > 0) { ?> <div id="gallery" class="ad-gallery"> <div class="ad-image-wrapper"></div> <div class="ad-controls"></div> <div class="ad-nav"> <div class="ad-thumbs"> <ul class="ad-thumb-list"> <?php while (next_image(true)) { if ($map) { $coord = getGeoCoord($_zp_current_image); if ($coord) { $points[] = $coord; } } if (isImagePhoto()) { // does not do video if (is_null($firstImage)) { $lastImage = imageNumber(); $firstImage = $lastImage; } else { $lastImage++; } ?> <li> <a href="<?php echo html_encode(getDefaultSizedImage()); ?> "> <img src="<?php echo html_encode(pathurlencode(getImageThumb())); ?> " class="image<?php echo $lastImage; ?> " alt="<?php echo html_encode(getImageDesc()); ?> "> </a> </li> <?php } } ?> </ul> </div> </div> </div> <?php } ?> <div id="caption"<?php if (getOption('effervescence_caption_location') == 'none') { echo ' style="display:none"'; } ?> > </div> <div class="clearage"></div> <?php if (!empty($points) && $map) { function map_callback($map) { global $points; foreach ($points as $coord) { addGeoCoord($map, $coord); } } ?> <div id="map_link"> <?php printGoogleMap(NULL, NULL, NULL, 'album_page', 'map_callback'); ?> </div> <?php } ?> </div><!-- images --> <?php if (function_exists('printAddToFavorites')) { printAddToFavorites($_zp_current_album); } ?> <?php @call_user_func('printRating'); ?> </div><!-- main --> <div class="clearage"></div> </div><!-- content --> <?php } }
function loadAlbum($album) { global $gallery, $_zp_current_album, $_zp_current_image; $subalbums = $album->getAlbums(); $started = false; $tcount = $count = 0; foreach ($subalbums as $folder) { $subalbum = new Album($gallery, $folder); if (!$subalbum->isDynamic()) { $tcount = $tcount + loadAlbum($subalbum); } } $theme = $gallery->getCurrentTheme(); $id = 0; $parent = getUrAlbum($album); $albumtheme = $parent->getAlbumTheme(); if (!empty($albumtheme)) { $theme = $albumtheme; $id = $parent->id; } loadLocalOptions($id, $theme); $_zp_current_album = $album; if ($album->getNumImages() > 0) { echo "<br />" . $album->name . ' '; while (next_image(true)) { $thumb = getImageThumb(); if (strpos($thumb, 'i.php?') === false) { $thumb = NULL; } if (isImagePhoto($_zp_current_image)) { $image = getDefaultSizedImage(); if (strpos($image, 'i.php?') === false) { $image = NULL; } } else { $image = NULL; if ($_zp_current_image->objectsThumb == NULL) { $thumb = NULL; } } if (!empty($thumb) || !empty($image)) { if (!$count) { $started = true; echo "{ "; } else { echo ' | '; } } if (!empty($thumb)) { echo '<img src="' . $thumb . '" height="8" width="8" /> '; } if (!empty($image)) { echo ' <img src="' . $image . '" height="20" width="20" />'; } if (!empty($thumb) || !empty($image)) { echo "\n"; } $count++; } if ($started) { echo ' } '; } printf(ngettext('[%u image]', '[%u images]', $count), $count); echo "<br />\n"; } return $count + $tcount; }
<?php } if (function_exists('printUserSizeImage') && isImagePhoto()) { printUserSizeImage(getImageTitle()); } else { printDefaultSizedImage(getImageTitle()); } if (!empty($fullimage)) { ?> </a> <?php } ?> </strong> <?php if (function_exists('printUserSizeImage') && isImagePhoto()) { printUserSizeSelector(); } ?> </div> <div id="narrow"> <?php printImageDesc(true); ?> <?php if (function_exists('printSlideShowLink')) { printSlideShowLink(gettext('View Slideshow')); } ?> <hr /><br />
/** * Prints an image or album statistic slideshow using the {@link http://galleria.io/ jQuery plugin Galleria} * * See readme/documentation for usage: * Call directly in a template file or codeblock. * * NOTE: movie and audio files not supported. * * @param string $type return statistics of either 'images' or 'albums' * @param integer $number the number of items to get (images or albums, depending on $type set) * @param string $option * "popular" for the most popular * "latest" for the latest uploaded by id (Discovery) * "latest-date" for the latest by date * "latest-mtime" for the latest by mtime * "latest-publishdate" for the latest by publishdate * "mostrated" for the most voted * "toprated" for the best voted * "latestupdated" for the latest updated * "random" for random order (yes, strictly no statistical order...) * @param string $albumfolder foldername of a specific album to pull items from * @param bool $collection only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums * @param bool $linkslides true to link to image or album on slide, else click advances slideshow instead * @param mixed $autoplay true to autoplay slideshow with interval set in options, false to start with slideshow stopped. Set integer in milliseconds to autoplay at that interval (Ex. 4000), overriding plugin option set. * @param integer $threshold the minimum number of ratings an image must have to be included in the list. (Default 0) * */ function printGslideshowStatistic($type, $number, $option, $albumfolder = '', $collection = false, $linkslides = true, $autoplay = true, $threshold = 0) { save_context(); $data = 'data'; $embedded = true; $forceheight = true; $imagenumber = 0; $albumtitle = ''; $returnpath = ''; require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/image_album_statistics.php'; if ($type == 'album' || $type == 'albums') { $albums = getAlbumStatistic($number, $option, $albumfolder); } else { $images = getImageStatistic($number, $option, $albumfolder, $collection, $threshold); } ?> <script> var data = [ <?php if ($type == 'album' || $type == 'albums') { $c = 1; foreach ($albums as $album) { $tempalbum = newAlbum($album['folder']); $albumpath = html_encode(rewrite_path("/" . pathurlencode($tempalbum->name), "index.php?album=" . pathurlencode($tempalbum->name))); $albumthumb = $tempalbum->getAlbumThumbImage(); $image = newImage($tempalbum, $albumthumb->filename); $ext = isImagePhoto($image); if ($ext) { makeImageCurrent($image); echo '{' . "\n"; echo 'thumb: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_thumbsize'), getOption('gslideshow_thumbsize')) . '\',' . "\n"; echo 'image: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_mediumsize'), getOption('gslideshow_mediumsize')) . '\',' . "\n"; echo 'big: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_bigsize'), getOption('gslideshow_bigsize')) . '\',' . "\n"; echo 'title: \'' . html_encode($tempalbum->getTitle()) . '\',' . "\n"; $desc = $tempalbum->getDesc(); $desc = str_replace("\r\n", '<br />', $desc); $desc = str_replace("\r", '<br />', $desc); echo 'description: \'' . js_encode($desc) . '\',' . "\n"; echo 'link: \'' . $albumpath . '\'' . "\n"; if ($c == $number) { echo '}' . "\n"; } else { echo '},' . "\n"; } } $c++; } echo "\n"; } else { $c = 1; foreach ($images as $image) { $ext = isImagePhoto($image); if ($ext) { makeImageCurrent($image); echo '{' . "\n"; echo 'thumb: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_thumbsize'), getOption('gslideshow_thumbsize')) . '\',' . "\n"; echo 'image: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_mediumsize'), getOption('gslideshow_mediumsize')) . '\',' . "\n"; echo 'big: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_bigsize'), getOption('gslideshow_bigsize')) . '\',' . "\n"; echo 'title: \'' . html_encode($image->getTitle()) . '\',' . "\n"; $desc = $image->getDesc(); $desc = str_replace("\r\n", '<br />', $desc); $desc = str_replace("\r", '<br />', $desc); echo 'description: \'' . js_encode($desc) . '\',' . "\n"; echo 'link: \'' . html_encode($image->getLink()) . '\'' . "\n"; if ($c == $number) { echo '}' . "\n"; } else { echo '},' . "\n"; } } $c++; } echo "\n"; } ?> ]; </script> <?php printGalleriaRun($data, $linkslides, $autoplay, $embedded, $forceheight, $imagenumber, $albumtitle, $returnpath); restore_context(); // needed if the slideshow is for example called directly via album object before the next_album loop on index.php }
echo getPrevImageURL(); ?> "><span class="prev"></span></a> <?php } else { ?> <span class="prev-disabled"></span> <?php } ?> <?php ?> <?php if ($width > 650) { if (extensionEnabled('colorbox_js') && isImagePhoto()) { $boxclass = " class=\"thickbox\""; } else { if (!extensionEnabled('colorbox_js')) { $boxclass = NULL; } } ?> <a href="<?php echo getFullImageURL(); ?> "<?php echo $boxclass; ?> id="zoom"><span class="zoom"></span></a> <?php
?> <span><a href="<?php echo html_encode(getFullImageURL()); ?> " title="<?php echo gettext('Download'); ?> "><?php echo gettext('Download') . ' (' . getFullWidth() . ' x ' . getFullHeight() . ')'; ?> </a></span><?php } ?> <?php if (getOption('zpbase_galss')) { if (isImagePhoto()) { ?> <span><?php printBaseSlideShowLink(); ?> </span><?php } ?> <?php } elseif (function_exists('printSlideShowLink')) { ?> <span><?php printSlideShowLink(); ?> </span> <?php
function printBaseSlideShow() { global $_zp_gallery, $_zp_gallery_page, $_myFavorites, $_zp_conf_vars, $_zp_themeroot, $isMobile, $isTablet; if (!isset($_POST['albumid'])) { return '<div class="errorbox" id="message"><h2>' . gettext('Invalid linking to the slideshow page.') . '</h2></div>'; } //getting the image to start with if (!empty($_POST['imagenumber'])) { $imagenumber = sanitize_numeric($_POST['imagenumber']) - 1; // slideshows starts with 0, but zp with 1. } else { $imagenumber = 0; } // set pagenumber to 0 if not called via POST link if (isset($_POST['pagenr'])) { $pagenumber = sanitize_numeric($_POST['pagenr']); } else { $pagenumber = 1; } // getting the number of images if (!empty($_POST['numberofimages'])) { $numberofimages = sanitize_numeric($_POST['numberofimages']); } else { $numberofimages = 0; } //if ($imagenumber < 2 || $imagenumber > $numberofimages) { // $imagenumber = 0; //} //getting the album to show if (!empty($_POST['albumid'])) { $albumid = sanitize_numeric($_POST['albumid']); } else { $albumid = 0; } if (isset($_POST['preserve_search_params'])) { // search page $search = new SearchEngine(); $params = sanitize($_POST['preserve_search_params']); $search->setSearchParams($params); $searchwords = $search->getSearchWords(); $searchdate = $search->getSearchDate(); $searchfields = $search->getSearchFields(true); $page = $search->page; $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page); $albumobj = new AlbumBase(NULL, false); $albumobj->setTitle(gettext('Search')); $albumobj->images = $search->getImages(0); $albumtitle = gettext('Search'); } else { if (isset($_POST['favorites_page'])) { $albumobj = $_myFavorites; $returnpath = rewrite_path($_myFavorites->getLink() . '/' . $pagenumber, FULLWEBPATH . '/index.php?p=favorites' . '&page=' . $pagenumber); $albumtitle = gettext('Favorites'); } else { $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . $albumid); $albumobj = newAlbum($albumq['folder']); $albumtitle = $albumobj->getTitle(); if (empty($_POST['imagenumber'])) { $returnpath = $albumobj->getLink($pagenumber); } else { $image = newImage($albumobj, sanitize($_POST['imagefile'])); $returnpath = $image->getLink(); } } } if (!$albumobj->isMyItem(LIST_RIGHTS) && !checkAlbumPassword($albumobj)) { return '<div class="errorbox" id="message"><h2>' . gettext('This album is password protected!') . '</h2></div>'; } $slideshow = ''; $numberofimages = $albumobj->getNumImages(); if ($numberofimages == 0) { return '<div class="errorbox" id="message"><h2>' . gettext('No images for the slideshow!') . '</h2></div>'; } $images = $albumobj->getImages(0); // slideshow generate data for galleria ?> <script> var data = [ <?php for ($c = 0, $idx = 0; $c < $numberofimages; $c++, $idx++) { if (is_array($images[$idx])) { $filename = $images[$idx]['filename']; $album = newAlbum($images[$idx]['folder']); $image = newImage($album, $filename); } else { $filename = $images[$idx]; $image = newImage($albumobj, $filename); } if (isImagePhoto($image)) { makeImageCurrent($image); echo '{' . "\n"; echo 'thumb: \'' . getImageThumb() . '\',' . "\n"; echo 'image: \'' . getDefaultSizedImage() . '\',' . "\n"; echo 'big: \'' . getCustomImageURL(getOption('zpbase_galbigsize')) . '\',' . "\n"; echo 'title: \'' . js_encode($image->getTitle()) . '\',' . "\n"; $desc = $image->getDesc(); $desc = str_replace("\r\n", '<br />', $desc); $desc = str_replace("\r", '<br />', $desc); echo 'description: \'' . js_encode($desc) . '\',' . "\n"; if (!getOption('zpbase_nodetailpage')) { echo 'link: \'' . html_encode($image->getLink()) . '\'' . "\n"; } if ($c == $numberofimages - 1) { echo '}' . "\n"; } else { echo '},' . "\n"; } } else { if ($imagenumber > 0 && $imagenumber > $c) { $imagenumber--; } } } echo "\n"; ?> ]; </script> <?php $sspage = true; require_once 'inc/galleria-jscall.php'; }
<a href="<?php echo html_encode(getImageURL()); ?> " title="<?php printBareImageTitle(); ?> "> <?php printCustomSizedImage(getBareImageTitle(), null, null, getOption('zpbase_sds_maxheight'), null, null, null, null, 'remove-attributes', null, true); ?> </a> <?php } ?> <?php if ((getOption('zpbase_magnific_sds') || getOption('zpbase_nodetailpage')) && isImagePhoto($_zp_current_image)) { ?> <a title ="<?php echo getBareImageTitle(); ?> " class="image-popup" <?php if (!getOption('zpbase_nodetailpage')) { ?> data-source="<?php echo html_encode(getImageURL()); ?> " <?php } ?> href="<?php
<label class="nowrap"><input type="radio" name="link" value="title" id="link_title" onchange="zenchange();" /><?php echo gettext('title only'); ?> </label> <label class="nowrap"><input type="radio" name="link" value="link" id="link_on" checked="checked" onchange="zenchange();" /><?php echo $token; ?> </label> <?php } ?> </p> <div id="content"></div> <?php if ($image && !$picture && isImagePhoto($obj)) { ?> <a href="javascript:launchScript('<?php echo WEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER; ?> /crop_image.php',['a=<?php echo str_replace('%27', "\\'", pathurlencode($args['album'])); ?> ','i=<?php echo str_replace('%27', "\\'", urlencode($args['image'])); ?> ','performcrop=pasteobj','size='+$('#imagesize').val()]);" title="<?php echo gettext('Click to bring up the custom cropping page.'); ?> "> <img src="<?php
} else { $imgpath = $imageobj->getThumbImageFile(); if ($imageobj->objectsThumb == NULL) { $imagepart = makeSpecialImageName($imgpath); } else { $imagepart = basename($imgpath); } $timg = get_image($imgpath); $width = imagesx($timg); $height = imagesy($timg); } if (getOption('thumb_crop')) { $thumbcropwidth = $cropwidth; $thumbcropheight = $cropheight; } else { if (isImagePhoto($imageobj)) { $thumbcropwidth = $imageobj->getWidth(); $thumbcropheight = $imageobj->getHeight(); } else { $imgpath = getThumbImageFile(); if ($this->objectsThumb == NULL) { $imagepart = makeSpecialImageName($imgpath); } else { $imagepart = basename($imgpath); } $thumbcropwidth = imagesx($timg); $thumbcropheight = imagesy($timg); } $tsize = getOption('thumb_size'); $max = max($thumbcropwidth, $thumbcropheight); $thumbcropwidth = $thumbcropwidth * ($tsize / $max);
?> <a class="masonry-image-popup" href="<?php echo html_encode(getImageURL()); ?> ?show=imagepage" title="<?php printBareImageTitle(); ?> "><img src="<?php echo $_zp_themeroot; ?> /images/zoom-in-2-n.png" alt="<?php echo gettext('Image Details'); ?> " /></a> <?php } elseif (isImagePhoto($_zp_current_image)) { ?> <a title ="<?php echo getBareImageTitle(); ?> " class="masonry-image-popup" <?php if (!getOption('zpbase_nodetailpage')) { ?> data-source="<?php echo html_encode(getImageURL()); ?> " <?php } ?> href="<?php echo htmlspecialchars(getDefaultSizedImage());
/** * Gets the album's set thumbnail image from the database if one exists, * otherwise, finds the first image in the album or sub-album and returns it * as an Image object. * * @return Image */ function getAlbumThumbImage() { global $_zp_albumthumb_selector, $_zp_gallery; if (!is_null($this->albumthumbnail)) { return $this->albumthumbnail; } $albumdir = $this->localpath; $thumb = $this->get('thumb'); if (is_null($thumb)) { $this->set('thumb', $thumb = getOption('AlbumThumbSelect')); } $i = strpos($thumb, '/'); if ($root = $i === 0) { $thumb = substr($thumb, 1); // strip off the slash $albumdir = ALBUM_FOLDER_SERVERPATH; } if (!empty($thumb) && !is_numeric($thumb)) { if (file_exists($albumdir . internalToFilesystem($thumb))) { if ($i === false) { return newImage($this, $thumb); } else { $pieces = explode('/', $thumb); $i = count($pieces); $thumb = $pieces[$i - 1]; unset($pieces[$i - 1]); $albumdir = implode('/', $pieces); if (!$root) { $albumdir = $this->name . "/" . $albumdir; } else { $albumdir = $albumdir . "/"; } $this->albumthumbnail = newImage(newAlbum($albumdir), $thumb); return $this->albumthumbnail; } } else { $this->set('thumb', $thumb = getOption('AlbumThumbSelect')); } } if ($shuffle = empty($thumb)) { $thumbs = $this->getImages(0, 0, NULL, NULL, false); } else { $thumbs = $this->getImages(0, 0, $_zp_albumthumb_selector[(int) $thumb]['field'], $_zp_albumthumb_selector[(int) $thumb]['direction']); } if (!is_null($thumbs)) { if ($shuffle) { shuffle($thumbs); } $mine = $this->isMyItem(LIST_RIGHTS); $other = NULL; while (count($thumbs) > 0) { // first check for images $thumb = array_shift($thumbs); $thumb = newImage($this, $thumb); if ($mine || $thumb->getShow()) { if (isImagePhoto($thumb)) { // legitimate image $this->albumthumbnail = $thumb; return $this->albumthumbnail; } else { if (!is_null($thumb->objectsThumb)) { // "other" image with a thumb sidecar $this->albumthumbnail = $thumb; return $this->albumthumbnail; } else { if (is_null($other)) { $other = $thumb; } } } } } if (!is_null($other)) { // "other" image, default thumb $this->albumthumbnail = $other; return $this->albumthumbnail; } } // Otherwise, look in sub-albums. $subalbums = $this->getAlbums(); if (!is_null($subalbums)) { if ($shuffle) { shuffle($subalbums); } while (count($subalbums) > 0) { $folder = array_pop($subalbums); $subalbum = newAlbum($folder); $pwd = $subalbum->getPassword(); if ($subalbum->getShow() && empty($pwd) || $subalbum->isMyItem(LIST_RIGHTS)) { $thumb = $subalbum->getAlbumThumbImage(); if (strtolower(get_class($thumb)) !== 'transientimage' && $thumb->exists) { $this->albumthumbnail = $thumb; return $thumb; } } } } $nullimage = SERVERPATH . '/' . ZENFOLDER . '/images/imageDefault.png'; // check for theme imageDefault.png $theme = ''; $uralbum = getUralbum($this); $albumtheme = $uralbum->getAlbumTheme(); if (!empty($albumtheme)) { $theme = $albumtheme; } else { $theme = $_zp_gallery->getCurrentTheme(); } if (!empty($theme)) { $themeimage = SERVERPATH . '/' . THEMEFOLDER . '/' . $theme . '/images/imageDefault.png'; if (file_exists(internalToFilesystem($themeimage))) { $nullimage = $themeimage; } } $this->albumthumbnail = new transientimage($this, $nullimage); return $this->albumthumbnail; }
/** * Print normal video or custom sized images. * Note: a class of 'not_visible' or 'password_protected' will be added as appropriate * * @param string $alt Alt text for the url * @param int $size size * @param int $width width * @param int $height height * @param int $cropw crop width * @param int $croph crop height * @param int $cropx crop x axis * @param int $cropy crop y axis * @param string $class Optional style class * @param string $id Optional style id * @param bool $thumbStandin set true to inhibit watermarking * */ function printCustomSizedImage($alt, $size, $width = NULL, $height = NULL, $cropw = NULL, $croph = NULL, $cropx = NULL, $cropy = NULL, $class = NULL, $id = NULL, $thumbStandin = false) { global $_zp_current_image; if (is_null($_zp_current_image)) { return; } if (!$_zp_current_image->getShow()) { $class .= " not_visible"; } $album = $_zp_current_image->getAlbum(); $pwd = $album->getPassword(); if (zp_loggedin() && !empty($pwd)) { $class .= " password_protected"; } if (isImagePhoto() || $thumbStandin) { echo '<img src="' . htmlspecialchars(getCustomImageURL($size, $width, $height, $cropw, $croph, $cropx, $cropy, $thumbStandin)) . '"' . ' alt="' . html_encode($alt) . '"' . ' title="' . html_encode($alt) . '"' . ($class ? ' class="' . $class . '"' : '') . ($id ? ' id="' . $id . '"' : '') . ' />'; } else { // better be a plugin echo $_zp_current_image->getBody(); } }