Exemple #1
0
 /**
  *  Get a custom sized version of this image based on the parameters.
  *
  * @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 ignored
  * @return string
  */
 function getCustomImage($size, $width, $height, $cropw, $croph, $cropx, $cropy, $thumbStandin = false, $effects = NULL)
 {
     if ($thumbStandin) {
         $wmt = getOption('Video_watermark');
         if (empty($wmt)) {
             $wmt = getWatermarkParam($this, WATERMARK_THUMB);
         }
     } else {
         $wmt = NULL;
     }
     if ($thumbStandin & 1) {
         $args = array($size, $width, $height, $cropw, $croph, $cropx, $cropy, NULL, $thumbStandin, NULL, $thumbStandin, NULL, NULL, NULL);
         if ($this->objectsThumb == NULL) {
             $filename = makeSpecialImageName($this->getThumbImageFile());
             if (!getOption('video_watermark_default_images')) {
                 $args[11] = '!';
             }
             $mtime = NULL;
         } else {
             $filename = filesystemToInternal($this->objectsThumb);
             $mtime = filemtime(ALBUM_FOLDER_SERVERPATH . '/' . internalToFilesystem($this->imagefolder) . '/' . $this->objectsThumb);
         }
         return getImageURI($args, $this->album->name, $filename, $this->filemtime);
     } else {
         $args = getImageParameters(array($size, $width, $height, $cropw, $croph, $cropx, $cropy, NULL, $thumbStandin, NULL, $thumbStandin, $wmt, NULL, $effects), $this->album->name);
         $filename = $this->filename;
         return getImageURI($args, $this->album->name, $filename, $this->filemtime);
     }
 }
Exemple #2
0
        exitZP();
}
if ($force_cache = getOption('cache_full_image')) {
    $cache_file = getImageCacheFilename($album, $image, $args);
    $cache_path = SERVERCACHE . $cache_file;
    mkdir_recursive(dirname($cache_path), FOLDER_MOD);
} else {
    $cache_file = $album . "/" . stripSuffix($image) . '_FULL.' . $suffix;
    $cache_path = NULL;
}
$process = $rotate = false;
if (zp_imageCanRotate()) {
    $rotate = getImageRotation($imageobj);
    $process = $rotate;
}
$watermark_use_image = getWatermarkParam($imageobj, WATERMARK_FULL);
if ($watermark_use_image == NO_WATERMARK) {
    $watermark_use_image = '';
} else {
    $process = 2;
}
if (isset($_GET['q'])) {
    $quality = sanitize_numeric($_GET['q']);
} else {
    $quality = getOption('full_image_quality');
}
if (!($process || $force_cache)) {
    // no processing needed
    if (getOption('album_folder_class') != 'external' && $disposal != 'Download') {
        // local album system, return the image directly
        header('Content-Type: image/' . $suffix);
Exemple #3
0
function getIPSizedImage($size, $image)
{
    $wmt = getWatermarkParam($image, WATERMARK_IMAGE);
    $args = getImageParameters(array($size, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $wmt), $image->album->name);
    return getImageProcessorURI($args, $image->album->name, $image->filename);
}
/**
 * Returns an url to the password protected/watermarked current image
 *
 * @param object $image optional image object overrides the current image
 * @param string $disposal set to override the 'protect_full_image' option
 * @return string
 * */
function getProtectedImageURL($image = NULL, $disposal = NULL)
{
    global $_zp_current_image;
    if (is_null($disposal)) {
        $disposal = getOption('protect_full_image');
    }
    if ($disposal == 'No access') {
        return NULL;
    }
    if (is_null($image)) {
        if (!in_context(ZP_IMAGE)) {
            return false;
        }
        if (is_null($_zp_current_image)) {
            return false;
        }
        $image = $_zp_current_image;
    }
    $album = $image->getAlbum();
    $watermark_use_image = getWatermarkParam($image, WATERMARK_FULL);
    if (!empty($watermark_use_image)) {
        $wmt = $watermark_use_image;
    } else {
        $wmt = false;
    }
    $args = array('FULL', NULL, NULL, NULL, NULL, NULL, NULL, (int) getOption('full_image_quality'), NULL, NULL, NULL, $wmt, false, NULL, NULL);
    $cache_file = getImageCacheFilename($album->name, $image->filename, $args);
    $cache_path = SERVERCACHE . $cache_file;
    if ($disposal != 'Download' && OPEN_IMAGE_CACHE && file_exists($cache_path)) {
        return WEBPATH . '/' . CACHEFOLDER . pathurlencode(imgSrcURI($cache_file));
    } else {
        if ($disposal == 'Unprotected') {
            return getImageURI($args, $album->name, $image->filename, $image->filemtime);
        } else {
            $params = '&q=' . getOption('full_image_quality');
            if (!empty($watermark_use_image)) {
                $params .= '&wmk=' . $watermark_use_image;
            }
            if ($disposal) {
                $params .= '&dsp=' . $disposal;
            }
            $params .= '&check=' . sha1(HASH_SEED . serialize($args));
            if (is_array($image->filename)) {
                $album = dirname($image->filename['source']);
                $image = basename($image->filename['source']);
            } else {
                $album = $album->name;
                $image = $image->filename;
            }
            return WEBPATH . '/' . ZENFOLDER . '/full-image.php?a=' . $album . '&i=' . $image . $params;
        }
    }
}
Exemple #5
0
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);
                        ?>
&amp;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);
                            ?>
&amp;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;
}
/**
 * Prints the images and/or albums as thumbnails of the selected album
 *
 * @param $number int The number of images per page
 *
 * @return string
 */
function printImageslist($number)
{
    global $_zp_gallery, $host;
    $args = array(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
    if (isset($_GET['album']) && !empty($_GET['album'])) {
        $album = urldecode(sanitize($_GET['album']));
        $albumobj = newAlbum($album);
        echo "<h3>" . gettext("Album:") . " <em>" . html_encode($albumobj->getTitle()) . unpublishedZenphotoItemCheck($albumobj, false) . "</em> / " . gettext("Album folder:") . " <em>" . html_encode($albumobj->name) . "</em><br /><small>" . gettext("(Click on image to include)") . "</small></h3>";
        $images_per_page = $number;
        if (isset($_GET['page'])) {
            $currentpage = sanitize_numeric($_GET['page']);
        } else {
            $currentpage = 1;
        }
        $imagecount = $albumobj->getNumImages();
        $pagestotal = ceil($imagecount / $images_per_page);
        printTinyPageNav($pagestotal, $currentpage, 'images');
        // album thumb display;
        $albumthumb = $albumobj->getAlbumThumbImage();
        $albumthumbalbum = $albumthumb->getAlbum();
        $albumdesc = $albumobj->getDesc();
        $imagedesc = $albumthumb->getDesc();
        $imgurl = getImageProcessorURI($args, $albumthumbalbum->name, $albumthumb->filename);
        $fullimage = pathurlencode(addslashes($albumthumb->getFullImage()));
        $imageType = getImageType($albumthumb);
        if ($imageType) {
            // Not a pure image
            $backgroundcss = 'albumthumb-image';
            $imgurl = $albumthumb->getThumb();
            $itemid = $albumthumb->getID();
        } else {
            $backgroundcss = 'albumthumb-other';
            $imgurl = getImageProcessorURI($args, $albumthumbalbum->name, $albumthumb->filename);
            $itemid = $albumthumb->getID();
        }
        $imgsizeurl = $albumthumb->getCustomImage(85, NULL, NULL, 85, 85, NULL, NULL, TRUE);
        echo "<div class='thumb'>";
        echo "<a href=\"javascript: ZenpageDialog.insert('" . $itemid . "','" . $imgurl . "','" . $albumobj->getThumb() . "','" . "','" . urlencode($albumthumb->filename) . "','" . js_encode($albumthumb->getTitle()) . "','" . js_encode($albumobj->getTitle()) . "','" . $fullimage . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'zenphoto','" . js_encode(getWatermarkParam($albumthumb, WATERMARK_THUMB)) . "','" . js_encode(getWatermarkParam($albumthumb, WATERMARK_IMAGE)) . "','" . $imageType . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . html_encode(addslashes($imagedesc)) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . html_encode(addslashes($albumdesc)) . "');\"" . " title='" . html_encode($albumthumb->getTitle()) . " (" . html_encode($albumthumb->filename) . ")'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img src='" . $imgsizeurl . "' class='" . $backgroundcss . "' /></a>\n";
        echo "<a href='../../../../../.." . html_encode($albumthumb->getLink()) . "' title='Zoom' rel='colorbox' style='outline: none;'><img src='img/magnify.png' alt='' style='border: 0' /></a> " . gettext('<em>Albumthumb</em>') . unpublishedZenphotoItemCheck($albumthumb, false);
        echo "</div>";
        $images = $albumobj->getImages();
        if ($albumobj->getNumImages() != 0) {
            for ($nr = 1; $nr <= $pagestotal; $nr++) {
                $startimage[$nr] = $nr * $images_per_page - $images_per_page;
                // get start image number
                $endimage[$nr] = $nr * $images_per_page - 1;
                // get end image number
            }
            $number = $startimage[$currentpage];
            for ($nr = $number; $nr <= $images_per_page * $currentpage; $nr++) {
                if ($nr === $imagecount) {
                    break;
                }
                if (is_array($images[$nr])) {
                    $linkalbumobj = newAlbum($images[$nr]['folder']);
                    $imageobj = newImage($linkalbumobj, $images[$nr]['filename']);
                } else {
                    $linkalbumobj = $albumobj;
                    $imageobj = newImage($albumobj, $images[$nr]);
                }
                $imagedesc = $imageobj->getDesc();
                $albumdesc = $linkalbumobj->getDesc();
                $fullimage = pathurlencode(addslashes($imageobj->getFullImage()));
                $imageType = getImageType($imageobj);
                $thumburl = $imageobj->getThumb();
                $imgurl = $imageobj->getLink(false);
                //$sizedimage = $imageobj->getSizedImage(getOption('image_size'));
                switch ($imageType) {
                    case '':
                        // image photo
                        $backgroundcss = 'thumb-image';
                        $imgurl = getImageProcessorURI($args, $linkalbumobj->name, $imageobj->filename);
                        $sizedimage = $imageobj->getSizedImage(getOption('image_size'));
                        $sizedimage = '<img src="' . $sizedimage . '" alt="' . $imageobj->getTitle() . '" class="zenpage_sizedimage" />';
                        $itemid = '';
                        break;
                    case 'textobject':
                        $sizedimage = $imageobj->getSizedImage(getOption('image_size'));
                        $sizedimage = str_replace('class="textobject"', 'class="textobject zenpage_sizedimage"', $sizedimage);
                        $imgurl = getImageProcessorURI($args, $linkalbumobj->name, $imageobj->filename);
                        $backgroundcss = 'thumb-textobject';
                        $itemid = '';
                        break;
                    case 'video':
                    case 'audio':
                        $sizedimage = $imageobj->getThumb();
                        $sizedimage = str_replace('class="flowplayer"', 'class="mediaplayer zenpage_sizedimage"', $sizedimage);
                        $imgurl = getImageProcessorURI($args, $linkalbumobj->name, $imageobj->filename);
                        $backgroundcss = 'thumb-multimedia';
                        $itemid = $imageobj->getID();
                        break;
                    default:
                        $sizedimage = $imageobj->getSizedImage(getOption('image_size'));
                        $backgroundcss = 'thumb-default';
                        $itemid = '';
                        break;
                }
                $imgsizeurl = $imageobj->getCustomImage(85, NULL, NULL, 85, 85, NULL, NULL, TRUE);
                echo "<div class='thumb'>\n";
                echo "<a href=\"javascript:ZenpageDialog.insert('" . $itemid . "','" . $imgurl . "','" . $thumburl . "','" . html_encode($sizedimage) . "','" . urlencode($imageobj->filename) . "','" . js_encode($imageobj->getTitle()) . "','" . js_encode($linkalbumobj->getTitle()) . "','" . $fullimage . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'zenphoto','" . js_encode(getWatermarkParam($imageobj, WATERMARK_THUMB)) . "','" . js_encode(getWatermarkParam($imageobj, WATERMARK_IMAGE)) . "','" . $imageType . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . html_encode(addslashes($imagedesc)) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . html_encode(addslashes($albumdesc)) . "');\"" . " title='" . html_encode($imageobj->getTitle()) . " (" . html_encode($imageobj->filename) . ")'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img src='" . $imgsizeurl . "' class='" . $backgroundcss . "' /></a>\n";
                echo "<a href='../../../../../.." . html_encode($imageobj->getLink()) . "' title='Zoom' rel='colorbox' style='outline: none;'><img src='img/magnify.png' alt='' style='border: 0' /></a> " . html_encode(shortentitle($imageobj->getTitle(), 8)) . unpublishedZenphotoItemCheck($imageobj, false);
                echo "</div>\n";
                if ($nr === $endimage[$currentpage]) {
                    break;
                }
            }
            // for end
        } else {
            echo "<p class='noimages'>" . gettext("<strong>Note:</strong> This album does not contain any images.") . "</p>";
        }
        // if/else  no image end
    }
    // if GET album end
}
 /**
  * Get a default-sized thumbnail of this image.
  *
  * @return string
  */
 function getThumb($type = 'image')
 {
     $ts = getOption('thumb_size');
     if (getOption('thumb_crop')) {
         list($custom, $sw, $sh, $cw, $ch, $cx, $cy) = $this->getThumbCropping($type);
         if ($custom) {
             return $this->getCustomImage(NULL, $sw, $sh, $cw, $ch, $cx, $cy, true);
         }
     } else {
         $sw = $sh = NULL;
     }
     $filename = $this->filename;
     $wmt = getWatermarkParam($this, WATERMARK_THUMB);
     $args = getImageParameters(array($ts, NULL, NULL, $sw, $sh, NULL, NULL, NULL, true, NULL, true, $wmt, NULL, NULL), $this->album->name);
     $cachefilename = getImageCacheFilename($alb = $this->album->name, $filename, $args);
     if (file_exists(SERVERCACHE . $cachefilename) && filemtime(SERVERCACHE . $cachefilename) > $this->filemtime) {
         return WEBPATH . '/' . CACHEFOLDER . pathurlencode(imgSrcURI($cachefilename));
     } else {
         return getImageProcessorURI($args, $this->album->name, $this->filename);
     }
 }
 /**
  *  Get a custom sized version of this image based on the parameters.
  *
  * @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 ignored
  * @return string
  */
 function getCustomImage($size, $width, $height, $cropw, $croph, $cropx, $cropy, $thumbStandin = false, $effects = NULL)
 {
     if ($thumbStandin) {
         $wmt = getOption('Video_watermark');
         if (empty($wmt)) {
             $wmt = getWatermarkParam($this, WATERMARK_THUMB);
         }
     } else {
         $wmt = NULL;
     }
     $args = getImageParameters(array($size, $width, $height, $cropw, $croph, $cropx, $cropy, NULL, $thumbStandin, NULL, $thumbStandin, $wmt, NULL, $effects), $this->album->name);
     if ($thumbStandin & 1) {
         if ($this->objectsThumb == NULL) {
             $filename = makeSpecialImageName($this->getThumbImageFile());
             if (!getOption('video_watermark_default_images')) {
                 $args[11] = '!';
             }
             return getImageProcessorURI($args, $this->album->name, $filename);
         } else {
             $filename = $this->objectsThumb;
             $cachefilename = getImageCacheFilename($alb = $this->album->name, $filename, getImageParameters(array($size, $width, $height, $cropw, $croph, $cropx, $cropy, NULL, $thumbStandin, NULL, $thumbStandin, NULL, NULL, NULL)), $this->album->name);
             if (file_exists(SERVERCACHE . $cachefilename) && filemtime(SERVERCACHE . $cachefilename) > $this->filemtime) {
                 return WEBPATH . '/' . CACHEFOLDER . pathurlencode(imgSrcURI($cachefilename));
             } else {
                 return getImageProcessorURI($args, $this->album->name, $filename);
             }
         }
     } else {
         $filename = $this->filename;
         $cachefilename = getImageCacheFilename($this->album->name, $filename, $args);
         if (file_exists(SERVERCACHE . $cachefilename) && filemtime(SERVERCACHE . $cachefilename) > $this->filemtime) {
             return WEBPATH . '/' . CACHEFOLDER . pathurlencode(imgSrcURI($cachefilename));
         } else {
             return getImageProcessorURI($args, $this->album->name, $filename);
         }
     }
 }
Exemple #9
0
 /**
  * Get a default-sized thumbnail of this image.
  *
  * @return string
  */
 function getThumb($type = 'image', $wmt = NULL)
 {
     $ts = getOption('thumb_size');
     if (getOption('thumb_crop')) {
         $sw = getOption('thumb_crop_width');
         $sh = getOption('thumb_crop_height');
         list($custom, $cw, $ch, $cx, $cy) = $this->getThumbCropping($ts, $sw, $sh);
         if ($custom) {
             return $this->getCustomImage(NULL, $sw, $sh, $cw, $ch, $cx, $cy, true);
         }
     } else {
         $sw = $sh = NULL;
     }
     if (empty($wmt)) {
         $wmt = getWatermarkParam($this, WATERMARK_THUMB);
     }
     $args = getImageParameters(array($ts, NULL, NULL, $sw, $sh, NULL, NULL, NULL, true, NULL, true, $wmt, NULL, NULL), $this->album->name);
     return getImageURI($args, $this->album->name, $this->filename, $this->filemtime);
 }
/**
 * Prints the images and/or albums as thumbnails of the selected album
 *
 * @param $number int The number of images per page
 *
 * @return string
 */
function printImageslist($number)
{
    global $_zp_gallery, $host;
    if (isset($_GET['album']) and !empty($_GET['album'])) {
        $album = urldecode(sanitize($_GET['album']));
        $albumobj = new Album($_zp_gallery, $album);
        echo "<h3 style='margin-bottom:10px'>" . gettext("Album:") . " <em>" . html_encode($albumobj->getTitle()) . unpublishedZenphotoItemCheck($albumobj, false) . "</em> / " . gettext("Album folder:") . " <em>" . html_encode($albumobj->name) . "</em><br /><small>" . gettext("(Click on image to include)") . "</small></h3>";
        // album thumb display;
        $albumthumb = $albumobj->getAlbumThumbImage();
        $albumthumbalbum = $albumthumb->getAlbum();
        $albumdesc = '';
        $albumdesc = $albumobj->getDesc();
        $imagedesc = $albumthumb->getDesc();
        $imgurl = $host . WEBPATH . '/' . ZENFOLDER . "/i.php?a=" . urlencode(pathurlencode($albumthumbalbum->name)) . "&amp;i=" . urlencode(urlencode($albumthumb->filename));
        $fullimage = pathurlencode($albumthumb->getFullImage());
        $videocheck = checkIfImageVideo($albumthumb);
        if (get_class($albumthumb) == '_Image') {
            $video = '';
            $backgroundcss = 'border: 1px solid gray; padding: 1px;';
            $imgurl = $host . WEBPATH . '/' . ZENFOLDER . "/i.php?a=" . urlencode(pathurlencode($albumthumbalbum->name)) . "&amp;i=" . urlencode(urlencode($albumthumb->filename));
        } else {
            $backgroundcss = 'border: 1px solid orange; padding: 1px;background-color: orange';
            $video = $videocheck;
            $imgurl = $albumthumb->getThumb();
        }
        $imgsizeurl = $albumthumb->getCustomImage(85, NULL, NULL, 85, 85, NULL, NULL, TRUE);
        echo "<div class='albumthumb' style='width: 85px; height: 100px; float: left; margin: 10px 10px 10px 13px'>";
        echo "<a href=\"javascript:ZenpageDialog.insert('" . $imgurl . "','" . urlencode($albumthumb->filename) . "','" . html_encode($albumthumb->getTitle()) . "','" . html_encode($albumobj->getTitle()) . "','" . $fullimage . "','zenphoto','" . html_encode(getWatermarkParam($albumthumb, WATERMARK_THUMB)) . "','" . html_encode(getWatermarkParam($albumthumb, WATERMARK_IMAGE)) . "','" . $video . "','" . html_encode($imagedesc) . "','" . html_encode($albumdesc) . "');\"" . " title='" . html_encode($albumthumb->getTitle()) . " (" . html_encode($albumthumb->filename) . ")'><img src='" . $imgsizeurl . "' style='" . $backgroundcss . "' /></a>\n";
        echo "<a href='zoom.php?image=" . urlencode($albumthumb->filename) . "&amp;album=" . pathurlencode($albumthumbalbum->name) . "' title='Zoom' rel='colorbox' style='outline: none;'><img src='img/magnify.png' alt='' style='border: 0' /></a> " . gettext('<em>Albumthumb</em>') . unpublishedZenphotoItemCheck($albumthumb, false);
        echo "</div>";
        $images = $albumobj->getImages();
        if ($albumobj->getNumImages() != 0) {
            $images_per_page = $number;
            if (isset($_GET['page'])) {
                $currentpage = sanitize_numeric($_GET['page']);
            } else {
                $currentpage = 1;
            }
            $imagecount = $albumobj->getNumImages();
            $pagestotal = ceil($imagecount / $images_per_page);
            for ($nr = 1; $nr <= $pagestotal; $nr++) {
                $startimage[$nr] = $nr * $images_per_page - $images_per_page;
                // get start image number
                $endimage[$nr] = $nr * $images_per_page - 1;
                // get end image number
            }
            $number = $startimage[$currentpage];
            printTinyPageNav($pagestotal, $currentpage, 'images');
            for ($nr = $number; $nr <= $images_per_page * $currentpage; $nr++) {
                if ($nr === $imagecount) {
                    break;
                }
                if ($albumobj->isDynamic()) {
                    $linkalbumobj = new Album($_zp_gallery, $images[$nr]['folder']);
                    $imageobj = newImage($linkalbumobj, $images[$nr]['filename']);
                } else {
                    $linkalbumobj = $albumobj;
                    $imageobj = newImage($albumobj, $images[$nr]);
                }
                $imagedesc = '';
                $imagedesc = $imageobj->getDesc();
                $albumdesc = '';
                $albumdesc = $linkalbumobj->getDesc();
                $fullimage = pathurlencode($imageobj->getFullImage());
                $videocheck = checkIfImageVideo($imageobj);
                if (get_class($imageobj) == '_Image') {
                    $video = '';
                    $backgroundcss = 'border: 1px solid gray; padding: 1px;';
                    $imgurl = $host . WEBPATH . '/' . ZENFOLDER . "/i.php?a=" . urlencode(pathurlencode($linkalbumobj->name)) . "&amp;i=" . urlencode(urlencode($imageobj->filename));
                } else {
                    if (get_class($imageobj) == 'TextObject' || get_parent_class($imageobj) == 'TextObject') {
                        $video = 'textobject';
                        $imgurl = $imageobj->getThumb();
                        $fullimage = html_encode($imageobj->getBody());
                    } else {
                        $backgroundcss = 'border: 1px solid orange; padding: 1px;background-color: orange';
                        $video = $videocheck;
                        $imgurl = $imageobj->getThumb();
                    }
                }
                $imgsizeurl = $imageobj->getCustomImage(85, NULL, NULL, 85, 85, NULL, NULL, TRUE);
                echo "<div style='width: 85px; height: 100px; float: left; margin: 10px 10px 10px 13px'>\n";
                echo "<a href=\"javascript:ZenpageDialog.insert('" . $imgurl . "','" . urlencode($imageobj->filename) . "','" . html_encode($imageobj->getTitle()) . "','" . html_encode($linkalbumobj->getTitle()) . "','" . $fullimage . "','zenphoto','" . html_encode(getWatermarkParam($imageobj, WATERMARK_THUMB)) . "','" . html_encode(getWatermarkParam($imageobj, WATERMARK_IMAGE)) . "','" . $video . "','" . html_encode($imagedesc) . "','" . html_encode($albumdesc) . "');\"" . " title='" . html_encode($imageobj->getTitle()) . " (" . html_encode($imageobj->filename) . ")'><img src='" . $imgsizeurl . "' style='" . $backgroundcss . "' /></a>\n";
                echo "<a href='zoom.php?image=" . urlencode($imageobj->filename) . "&amp;album=" . pathurlencode($linkalbumobj->name) . "' title='Zoom' rel='colorbox' style='outline: none;'><img src='img/magnify.png' alt='' style='border: 0' /></a> " . html_encode(shortentitle($imageobj->getTitle(), 8)) . unpublishedZenphotoItemCheck($imageobj, false);
                echo "</div>\n";
                if ($nr === $endimage[$currentpage]) {
                    break;
                }
            }
            // for end
        } else {
            echo "<p style='margin-left: 8px'>" . gettext("<strong>Note:</strong> This album does not contain any images.") . "</p>";
        }
        // if/else  no image end
    }
    // if GET album end
}
/**
 * Returns an url to the password protected/watermarked current image
 *
 * @param object $image optional image object overrides the current image
 * @param string $disposal set to override the 'protect_full_image' option
 * @return string
 **/
function getProtectedImageURL($image = NULL, $disposal = NULL)
{
    global $_zp_current_image;
    if ($disposal == 'No access') {
        return NULL;
    }
    if (is_null($image)) {
        if (!in_context(ZP_IMAGE)) {
            return false;
        }
        if (is_null($_zp_current_image)) {
            return false;
        }
        $image = $_zp_current_image;
    }
    $album = $image->getAlbum();
    $wmt = $image->getWatermark();
    if (!empty($wmt) || !($image->getWMUse() & WATERMARK_FULL)) {
        $wmt = NULL;
    }
    $args = array('FULL', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $wmt, NULL);
    $cache_file = getImageCacheFilename($album->name, $image->filename, $args);
    $cache_path = SERVERCACHE . $cache_file;
    if (empty($disposal) && file_exists($cache_path)) {
        return WEBPATH . '/' . CACHEFOLDER . pathurlencode(imgSrcURI($cache_file));
    } else {
        $params = '&q=' . getOption('full_image_quality');
        $watermark_use_image = getWatermarkParam($image, WATERMARK_FULL);
        if (!empty($watermark_use_image)) {
            $params .= '&wmk=' . $watermark_use_image;
        }
        if ($disposal) {
            $params .= '&dsp=' . $disposal;
        }
        return WEBPATH . '/' . ZENFOLDER . '/full-image.php?a=' . urlencode($album->name) . '&i=' . urlencode($image->filename) . $params;
    }
}