本文整理汇总了PHP中Album::getAlbumThumbImage方法的典型用法代码示例。如果您正苦于以下问题:PHP Album::getAlbumThumbImage方法的具体用法?PHP Album::getAlbumThumbImage怎么用?PHP Album::getAlbumThumbImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Album
的用法示例。
在下文中一共展示了Album::getAlbumThumbImage方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: zenpageAlbumImage
/**
* support to show an image from an album
* The imagename is optional. If absent the album thumb image will be
* used and the link will be to the album. If present the link will be
* to the image.
*
* @param string $albumname
* @param string $imagename
* @param int $size the size to make the image. If omitted image will be 50% of 'image_size' option.
* @param bool $linkalbum set true to link specific image to album instead of image
*/
function zenpageAlbumImage($albumname, $imagename = NULL, $size = NULL, $linkalbum = false)
{
global $_zp_gallery;
echo '<br />';
$album = new Album($_zp_gallery, $albumname);
if ($album->loaded) {
if (is_null($size)) {
$size = floor(getOption('image_size') * 0.5);
}
$image = NULL;
if (is_null($imagename)) {
$linkalbum = true;
$image = $album->getAlbumThumbImage();
} else {
$image = newImage($album, $imagename);
}
if ($image && $image->loaded) {
makeImageCurrent($image);
if ($linkalbum) {
rem_context(ZP_IMAGE);
echo '<a href="' . html_encode(getAlbumLinkURL($album)) . '" title="' . sprintf(gettext('View the %s album'), $albumname) . '">';
add_context(ZP_IMAGE);
printCustomSizedImage(sprintf(gettext('View the album %s'), $albumname), $size);
rem_context(ZP_IMAGE | ZP_ALBUM);
echo '</a>';
} else {
echo '<a href="' . html_encode(getImageLinkURL($image)) . '" title="' . sprintf(gettext('View %s'), $imagename) . '">';
printCustomSizedImage(sprintf(gettext('View %s'), $imagename), $size);
rem_context(ZP_IMAGE | ZP_ALBUM);
echo '</a>';
}
} else {
?>
<span style="background:red;color:black;">
<?php
printf(gettext('<code>zenpageAlbumImage()</code> did not find the image %1$s:%2$s'), $albumname, $imagename);
?>
</span>
<?php
}
} else {
?>
<span style="background:red;color:black;">
<?php
printf(gettext('<code>zenpageAlbumImage()</code> did not find the album %1$s'), $albumname);
?>
</span>
<?php
}
}
示例2: getCombiNews
//.........这里部分代码省略.........
$stickyorder = '';
if ($sticky) {
$stickyorder = 'sticky DESC,';
}
$type3 = query("SET @type3:='0'");
switch ($mode) {
case "latestimages-thumbnail":
case "latestimages-thumbnail-customcrop":
case "latestimages-sizedimage":
$sortorder = "images." . $combinews_sortorder;
$type1 = query("SET @type1:='news'");
$type2 = query("SET @type2:='images'");
switch ($combinews_sortorder) {
case 'id':
case 'date':
$imagequery = "(SELECT albums.folder, images.filename, images.date, @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")";
break;
case 'mtime':
$imagequery = "(SELECT albums.folder, images.filename, FROM_UNIXTIME(images.mtime), @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")";
break;
}
$result = query_full_array("(SELECT title as albumname, titlelink, date, @type1 as type, sticky FROM " . prefix('news') . " " . $show . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $imagequery . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY {$stickyorder} date DESC {$limit}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t");
break;
case "latestalbums-thumbnail":
case "latestalbums-thumbnail-customcrop":
case "latestalbums-sizedimage":
$sortorder = $combinews_sortorder;
$type1 = query("SET @type1:='news'");
$type2 = query("SET @type2:='albums'");
switch ($combinews_sortorder) {
case 'id':
case 'date':
$albumquery = "(SELECT albums.folder, albums.title, albums.date, @type2, @type3 as sticky FROM " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t" . $show . $albumWhere . ")";
break;
case 'mtime':
$albumquery = "(SELECT albums.folder, albums.title, FROM_UNIXTIME(albums.mtime), @type2, @type3 as sticky FROM " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t" . $show . $albumWhere . ")";
break;
}
$result = query_full_array("(SELECT title as albumname, titlelink, date, @type1 as type, sticky FROM " . prefix('news') . " " . $show . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $albumquery . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY {$stickyorder} date DESC {$limit}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t");
break;
case "latestimagesbyalbum-thumbnail":
case "latestimagesbyalbum-thumbnail-customcrop":
case "latestimagesbyalbum-sizedimage":
$type1 = query("SET @type1:='news'");
$type2 = query("SET @type2:='albums'");
if (empty($combinews_sortorder) || $combinews_sortorder != "date" || $combinews_sortorder != "mtime") {
$combinews_sortorder = "date";
}
$combinews_sortorder = "date";
$sortorder = "images." . $combinews_sortorder;
switch ($combinews_sortorder) {
case "date":
$imagequery = "(SELECT DISTINCT DATE_FORMAT(" . $sortorder . ",'%Y-%m-%d'), albums.folder, DATE_FORMAT(images.`date`,'%Y-%m-%d'), @type2 FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")";
break;
case "mtime":
$imagequery = "(SELECT DISTINCT FROM_UNIXTIME(" . $sortorder . ",'%Y-%m-%d'), albums.folder, DATE_FORMAT(images.`mtime`,'%Y-%m-%d'), @type2 FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")";
break;
}
$result = query_full_array("(SELECT title as albumname, titlelink, date, @type1 as type FROM " . prefix('news') . " " . $show . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $imagequery . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER By date DESC {$limit}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t");
//echo "<pre>"; print_r($result); echo "</pre>";
//$result = "";
break;
case "latestupdatedalbums-thumbnail":
case "latestupdatedalbums-thumbnail-customcrop":
case "latestupdatedalbums-sizedimage":
$latest = getNewsArticles($articles_per_page, '', NULL, true);
$counter = '';
foreach ($latest as $news) {
$article = new ZenpageNews($news['titlelink']);
if ($article->checkAccess($hint, $show)) {
$counter++;
$latestnews[$counter] = array("albumname" => $article->getTitle(), "titlelink" => $article->getTitlelink(), "date" => $article->getDateTime(), "type" => "news");
}
}
$albums = getAlbumStatistic($articles_per_page, "latestupdated");
$latestalbums = array();
$counter = "";
foreach ($albums as $album) {
$counter++;
$tempalbum = new Album($_zp_gallery, $album['folder']);
$tempalbumthumb = $tempalbum->getAlbumThumbImage();
$timestamp = $tempalbum->get('mtime');
if ($timestamp == 0) {
$albumdate = $tempalbum->getDateTime();
} else {
$albumdate = strftime('%Y-%m-%d %H:%M:%S', $timestamp);
}
$latestalbums[$counter] = array("albumname" => $tempalbum->getFolder(), "titlelink" => $tempalbum->getTitle(), "date" => $albumdate, "type" => 'albums');
}
//$latestalbums = array_merge($latestalbums, $item);
$latest = array_merge($latestnews, $latestalbums);
$result = sortMultiArray($latest, "date", true);
if (count($result) > $articles_per_page) {
$result = array_slice($result, 0, 10);
}
break;
}
//$result = "";
return $result;
}
示例3: printAlbumStatisticItem
/**
* A helper function that only prints a item of the loop within printAlbumStatistic()
* Not for standalone use.
*
* @param array $album the array that getAlbumsStatistic() submitted
* @param string $option "popular" for the most popular albums,
* "latest" for the latest uploaded,
* "mostrated" for the most voted,
* "toprated" for the best voted
* "latestupdated" for the latest updated
* @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
*/
function printAlbumStatisticItem($album, $option, $showtitle = false, $showdate = false, $showdesc = false, $desclength = 40, $showstatistic = '', $width = 85, $height = 85, $crop = true, $firstimglink = false)
{
global $_zp_gallery;
$tempalbum = new Album($_zp_gallery, $album['folder']);
if ($firstimglink && $tempalbum->getNumImages() != 0) {
$firstimage = $tempalbum->getImages(1);
// need only the first so don't get all
$firstimage = $firstimage[0];
$modrewritesuffix = getOption('mod_rewrite_image_suffix');
$imagepath = html_encode(rewrite_path("/" . $firstimage . $modrewritesuffix, "&image=" . $firstimage, false));
} else {
$imagepath = "";
}
$albumpath = html_encode(rewrite_path("/" . pathurlencode($tempalbum->name) . $imagepath, "index.php?album=" . pathurlencode($tempalbum->name) . $imagepath));
echo "<li><a href=\"" . $albumpath . "\" title=\"" . html_encode($tempalbum->getTitle()) . "\">\n";
$albumthumb = $tempalbum->getAlbumThumbImage();
$thumb = newImage($tempalbum, $albumthumb->filename);
if ($crop) {
echo "<img src=\"" . html_encode($albumthumb->getCustomImage(NULL, $width, $height, $width, $height, NULL, NULL, TRUE)) . "\" alt=\"" . html_encode($albumthumb->getTitle()) . "\" /></a>\n<br />";
} else {
echo "<img src=\"" . html_encode($albumthumb->getCustomImage($width, NULL, NULL, NULL, NULL, NULL, NULL, TRUE)) . "\" alt=\"" . html_encode($albumthumb->getTitle()) . "\" /></a>\n<br />";
}
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->getAlbumID() . " AND `show` = 1 ORDER BY id DESC");
$lastuploaded = query("SELECT COUNT(*) FROM " . prefix('images') . " WHERE albumid = " . $tempalbum->getAlbumID() . " AND mtime = " . $latestimage['mtime']);
$row = db_fetch_row($lastuploaded);
$count = $row[0];
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->get("hitcounter");
if (empty($hitcounter)) {
$hitcounter = "0";
}
echo "<p>" . sprintf(gettext("Views: %u"), $hitcounter) . "</p>";
}
if ($showdesc) {
echo shortenContent($tempalbum->getDesc(), $desclength, ' (...)');
}
echo "</li>";
}
示例4: getAlbumThumbImage
/**
* 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()
{
if (!is_null($this->albumthumbnail)) {
return $this->albumthumbnail;
}
$albumdir = $this->localpath;
$thumb = $this->get('thumb');
$i = strpos($thumb, '/');
if ($root = $i === 0) {
$thumb = substr($thumb, 1);
// strip off the slash
$albumdir = ALBUM_FOLDER_SERVERPATH;
}
$shuffle = empty($thumb);
$field = getOption('AlbumThumbSelectField');
$direction = getOption('AlbumThumbSelectDirection');
if (!empty($thumb) && !is_numeric($thumb) && 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(new Album($this->gallery, $albumdir), $thumb);
return $this->albumthumbnail;
}
} else {
$this->getImages(0, 0, $field, $direction);
$thumbs = $this->images;
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 = new Album($this->gallery, $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';
if (OFFSET_PATH == 0) {
// check for theme imageDefault.png if we are in the gallery
//.........这里部分代码省略.........
示例5: strtolower
if ($rssmode != "albums") {
$ext = strtolower(strrchr($item->filename, "."));
$albumobj = $item->getAlbum();
$itemlink = $host . WEBPATH . $albumpath . pathurlencode($albumobj->name) . $imagepath . pathurlencode($item->filename) . $modrewritesuffix;
$fullimagelink = $host . WEBPATH . "/albums/" . pathurlencode($albumobj->name) . "/" . $item->filename;
$imagefile = "albums/" . $albumobj->name . "/" . $item->filename;
$thumburl = '<img border="0" src="' . $protocol . '://' . $host . $item->getCustomImage($size, NULL, NULL, NULL, NULL, NULL, NULL, TRUE) . '" alt="' . get_language_string(get_language_string($item->get("title"), $locale)) . '" />';
$itemcontent = '<![CDATA[<a title="' . html_encode(get_language_string($item->get("title"), $locale)) . ' in ' . html_encode(get_language_string($albumobj->get("title"), $locale)) . '" href="' . $protocol . '://' . $itemlink . '">' . $thumburl . '</a>' . get_language_string(get_language_string($item->get("desc"), $locale)) . ']]>';
$videocontent = '<![CDATA[<a title="' . html_encode(get_language_string($item->get("title"), $locale)) . ' in ' . html_encode(get_language_string($albumobj->getTitle(), $locale)) . '" href="' . $protocol . '://' . $itemlink . '"><img src="' . $protocol . '://' . $host . $item->getThumb() . '" alt="' . get_language_string(get_language_string($item->get("title"), $locale)) . '" /></a>' . get_language_string(get_language_string($item->get("desc"), $locale)) . ']]>';
$datecontent = '<![CDATA[Date: ' . zpFormattedDate(DATE_FORMAT, $item->get('mtime')) . ']]>';
} else {
$galleryobj = new Gallery();
$albumitem = new Album($galleryobj, $item['folder']);
$totalimages = $albumitem->getNumImages();
$itemlink = $host . WEBPATH . $albumpath . pathurlencode($albumitem->name);
$thumb = $albumitem->getAlbumThumbImage();
$thumburl = '<img border="0" src="' . $thumb->getCustomImage($size, NULL, NULL, NULL, NULL, NULL, NULL, TRUE) . '" alt="' . html_encode(get_language_string($albumitem->get("title"), $locale)) . '" />';
$title = get_language_string($albumitem->get("title"), $locale);
if (true || getOption("feed_sortorder_albums") == "latestupdated") {
$filechangedate = filectime(ALBUM_FOLDER_SERVERPATH . internalToFilesystem($albumitem->name));
$latestimage = query_single_row("SELECT mtime FROM " . prefix('images') . " WHERE albumid = " . $albumitem->getAlbumID() . " AND `show` = 1 ORDER BY id DESC");
$lastuploaded = query("SELECT COUNT(*) FROM " . prefix('images') . " WHERE albumid = " . $albumitem->getAlbumID() . " AND mtime = " . $latestimage['mtime']);
$row = db_fetch_row($lastuploaded);
$count = $row[0];
if ($count == 1) {
$imagenumber = sprintf(gettext('%s (1 new image)'), $title);
} else {
$imagenumber = sprintf(gettext('%1$s (%2$s new images)'), $title, $count);
}
$itemcontent = '<![CDATA[<a title="' . $title . '" href="' . $protocol . '://' . $itemlink . '">' . $thumburl . '</a>' . '<p>' . html_encode($imagenumber) . '</p>' . html_encode(get_language_string($albumitem->get("desc"), $locale)) . ']]>';
$videocontent = '';
示例6: getAlbumThumbImage
/**
* 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()
{
if (!is_null($this->albumthumbnail)) {
return $this->albumthumbnail;
}
$albumdir = $this->localpath;
$thumb = $this->get('thumb');
$i = strpos($thumb, '/');
if ($root = $i === 0) {
$thumb = substr($thumb, 1);
// strip off the slash
$albumdir = getAlbumFolder();
}
$shuffle = $thumb != '1';
if (!empty($thumb) && $thumb != '1' && file_exists($albumdir . UTF8ToFilesystem($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(new Album($this->gallery, $albumdir), $thumb);
return $this->albumthumbnail;
}
} else {
if ($this->isDynamic()) {
$this->getImages(0, 0, 'ID', 'DESC');
$thumbs = $this->images;
if (!is_null($thumbs)) {
if ($shuffle) {
shuffle($thumbs);
}
while (count($thumbs) > 0) {
$thumb = array_shift($thumbs);
if (is_valid_image($thumb['filename'])) {
$alb = new Album($this->gallery, $thumb['folder']);
$thumb = newImage($alb, $thumb['filename']);
if ($thumb->getShow()) {
$this->albumthumbnail = $thumb;
return $thumb;
}
}
}
}
} else {
$this->getImages(0, 0, 'ID', 'DESC');
$thumbs = $this->images;
if (!is_null($thumbs)) {
if ($shuffle) {
shuffle($thumbs);
}
while (count($thumbs) > 0) {
$thumb = array_shift($thumbs);
if (is_valid_image($thumb)) {
$thumb = newImage($this, $thumb);
if ($thumb->getShow()) {
$this->albumthumbnail = $thumb;
return $thumb;
}
}
}
}
// Otherwise, look in sub-albums.
$subalbums = $this->getSubAlbums();
if (!is_null($subalbums)) {
if ($shuffle) {
shuffle($subalbums);
}
while (count($subalbums) > 0) {
$folder = array_pop($subalbums);
$subalbum = new Album($this->gallery, $folder);
$pwd = $subalbum->getPassword();
if ($subalbum->getShow() && empty($pwd) || isMyALbum($folder, ALL_RIGHTS)) {
$thumb = $subalbum->getAlbumThumbImage();
if (strtolower(get_class($thumb)) !== 'transientimage' && $thumb->exists) {
$this->albumthumbnail = $thumb;
return $thumb;
}
}
}
}
//jordi-kun - no images, no subalbums, check for videos
$dp = opendir($albumdir);
while ($thumb = readdir($dp)) {
if (is_file($albumdir . $thumb) && is_valid_video($thumb)) {
$othersThumb = checkObjectsThumb($albumdir, $thumb);
//.........这里部分代码省略.........
示例7: printAlbumStatisticItem
/**
* A helper function that only prints a item of the loop within printAlbumStatistic()
* Not for standalone use.
*
* @param array $album the array that getAlbumsStatistic() submitted
* @param string $option "popular" for the most popular albums,
* "latest" for the latest uploaded,
* "mostrated" for the most voted,
* "toprated" for the best voted
* "latestupdated" for the latest updated
* @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
*/
function printAlbumStatisticItem($album, $option, $showtitle = false, $showdate = false, $showdesc = false, $desclength = 40, $showstatistic = '', $width = 85, $height = 85, $crop = true)
{
global $_zp_gallery;
$albumpath = rewrite_path("/", "index.php?album=");
$tempalbum = new Album($_zp_gallery, $album['folder']);
echo "<li><a href=\"" . $albumpath . pathurlencode($tempalbum->name) . "\" title=\"" . html_encode($tempalbum->getTitle()) . "\">\n";
$albumthumb = $tempalbum->getAlbumThumbImage();
$thumb = newImage($tempalbum, $albumthumb->filename);
if ($crop) {
echo "<img src=\"" . $thumb->getCustomImage(NULL, $width, $height, $width, $height, NULL, NULL, TRUE) . "\" alt=\"" . html_encode($thumb->getTitle()) . "\" /></a>\n<br />";
} else {
echo "<img src=\"" . $thumb->getCustomImage($width, NULL, NULL, NULL, NULL, NULL, NULL, TRUE) . "\" alt=\"" . html_encode($thumb->getTitle()) . "\" /></a>\n<br />";
}
if ($showtitle) {
echo "<h3><a href=\"" . $albumpath . pathurlencode($tempalbum->name) . "\" title=\"" . html_encode($tempalbum->getTitle()) . "\">\n";
echo $tempalbum->getTitle() . "</a></h3>\n";
}
if ($showdate) {
if ($option === "latestupdated") {
$filechangedate = filectime(getAlbumFolder() . UTF8ToFilesystem($tempalbum->name));
$latestimage = query_single_row("SELECT mtime FROM " . prefix('images') . " WHERE albumid = " . $tempalbum->getAlbumID() . " AND `show` = 1 ORDER BY id DESC");
$lastuploaded = query("SELECT COUNT(*) FROM " . prefix('images') . " WHERE albumid = " . $tempalbum->getAlbumID() . " AND mtime = " . $latestimage['mtime']);
$row = mysql_fetch_row($lastuploaded);
$count = $row[0];
echo "<p>" . sprintf(gettext("Last update: %s"), zpFormattedDate(getOption('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(getOption('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->get("hitcounter");
if (empty($hitcounter)) {
$hitcounter = "0";
}
echo "<p>" . sprintf(gettext("Views: %u"), $hitcounter) . "</p>";
}
if ($showdesc) {
echo "<p>" . truncate_string($tempalbum->getDesc(), $desclength) . "</p>";
}
echo "</li>";
}
示例8: flowplayerPlaylist
/**
* Show the content of an media album with .flv/.mp4/.mp3 movie/audio files only as a playlist or as separate players with Flowplayer 3
* Important: The Flowplayer 3 plugin needs to be activated to use this plugin. This plugin shares all settings with this plugin, too.
*
* You can either show a 'one player window' playlist or show all items as separate players paginated. See the examples below.
* (set in the settings for thumbs per page) on one page (like on a audio or podcast blog).
*
* There are two usage modes:
*
* a) 'playlist'
* The playlist is meant to replace the 'next_image()' loop on a theme's album.php.
* It can be used with a special 'album theme' that can be assigned to media albums with with .flv/.mp4/.mp3s, although Flowplayer 3 also supports images
* Replace the entire 'next_image()' loop on album.php with this:
* <?php flowplayerPlaylist("playlist"); ?>
*
* This produces the following html:
* <div class="wrapper">
* <a class="up" title="Up"></a>
* <div class="playlist">
* <div class="clips">
* <!-- single playlist entry as an "template" -->
* <a href="${url}">${title}</a>
* </div>
* </div>
* <a class="down" title="Down"></a>
* </div>
* </div>
* This is styled by the css file 'playlist.css" that is located within the 'zp-core/plugins/flowplayer3_playlist/flowplayer3_playlist.css' by default.
* Alternatively you can style it specifically for your theme. Just place a css file named "flowplayer3_playlist.css" in your theme's folder.
*
* b) 'players'
* This displays each audio/movie file as a separate player on album.php.
* If there is no videothumb image for an mp3 file existing only the player control bar is shown.
* Modify the 'next_image()' loop on album.php like this:
* <?php
* while (next_image()):
* flowplayerPlaylist("players");
* endwhile;
* ?>
* Of course you can add further functions to b) like printImageTitle() etc., too.
*
* @param string $option The mode to use "players", "playlist" or "playlist-mp3". "playlist-mp3" is the same as "playlist" except that only the controlbar is shown (if you are too lazy for custom video thumbs and don't like the empty screen)
* @param string $albumfolder For "playlist" mode only: To show a playlist of an specific album directly on another page (for example on index.php). Note: Currently it is not possible to have several playlists on one page
*/
function flowplayerPlaylist($option = "playlist", $albumfolder = "")
{
global $_zp_current_image, $_zp_current_album, $_zp_flash_player;
$curdir = getcwd();
chdir(SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/flowplayer3');
$filelist = safe_glob('flowplayer-*.swf');
$swf = array_shift($filelist);
$filelist = safe_glob('flowplayer.audio-*.swf');
$audio = array_shift($filelist);
$filelist = safe_glob('flowplayer.controls-*.swf');
$controls = array_shift($filelist);
chdir($curdir);
$playlistwidth = getOption('flow_player3_playlistwidth');
$playlistheight = getOption('flow_player3_playlistheight');
switch ($option) {
case 'playlist':
case 'playlist-mp3':
$splashimage = getOption('flow_player3_playlistsplashimage');
if ($option == 'playlist-mp3') {
$playlistheight = FLOW_PLAYER_MP3_HEIGHT;
$splashimage = 'none';
}
if (empty($albumfolder)) {
$albumname = $_zp_current_album->name;
} else {
$albumname = $albumfolder;
}
$album = new Album(new Gallery(), $albumname);
if (getOption("flow_player3_playlistautoplay") == 1) {
$autoplay = 'true';
} else {
$autoplay = 'false';
}
$playlist = $album->getImages();
// slash image fetching
$videoobj = new Video($album, $playlist[0]);
$albumfolder = $album->name;
$splashimagerwidth = $playlistwidth;
$splashimageheight = $playlistheight;
$videoThumbImg = '';
if ($splashimage != 'none') {
switch ($splashimage) {
case 'albumthumb':
$albumthumbobj = $album->getAlbumThumbImage();
getMaxSpaceContainer($splashimagerwidth, $splashimageheight, $albumthumbobj, true);
$albumthumb = $albumthumbobj->getCustomImage(null, $splashimagerwidth, $splashimageheight, null, null, null, null, true);
$videoThumbImg = '<img src="' . pathurlencode($albumthumb) . '" alt="" />';
break;
case 'firstentry':
getMaxSpaceContainer($splashimagerwidth, $splashimageheight, $videoobj, true);
$videoThumb = $videoobj->getCustomImage(null, $splashimagerwidth, $splashimageheight, null, null, null, null, true);
$videoThumbImg = '<img src="' . pathurlencode($videoThumb) . '" alt="" />';
break;
}
}
if ($album->getNumImages() != 0) {
//.........这里部分代码省略.........
示例9: getSubalbumsHTML
function getSubalbumsHTML()
{
$numAlbums = $this->getNumAlbums();
if ($numAlbums <= 0 || $this->albumPage >= $this->getFirstImagePage()) {
return '';
}
global $_zp_themeroot, $_zp_gallery, $_zp_current_image, $_zp_current_album;
$w = 318;
$slideshowLink = $this->getSlideshowLink();
$subalbums = "<div id='subalbums'>";
$i = 0;
$albums = $this->getAlbums();
$page = $this->getAlbumPage();
$start = ($page - 1) * getOption('albums_per_page');
$albums = array_slice($albums, $start, getOption('albums_per_page'));
for ($u = 0; $u < count($albums); $u++) {
$a = new Album($_zp_gallery, $albums[$u]);
$thumb = $a->getAlbumThumbImage();
$title = $a->getTitle();
$desc = $a->getDesc();
$customThumb = $thumb->getCustomImage(NULL, 104, 56, 104, 56, NULL, NULL, false);
$subalbums .= "<span class='subalbum' id='subalbum-{$u}' width='104' height='56' >" . "<a href='" . getAlbumURL($a) . "' >" . "<img width='104' height='56' src='{$customThumb}'/></a></span>";
$i++;
}
$m = $i;
$i++;
while ($i <= getOption('albums_per_page')) {
$subalbums .= "<span class='subalbum' id='subalbum-{$i}'>" . "<img width='104' height='56' src='{$_zp_themeroot}/resources/images/opa/bg-b-20.png'/>" . "</span>";
$i++;
}
$subalbums .= "</div>";
$s = ($this->getAlbumPage() - 1) * getOption('albums_per_page');
$batch = $s + 1 . "-" . ($s + $m);
$subalbums = "<div id='subalbum-count' class='count'>" . (isset($slideshowLink) && $this->getNumImages() > 0 ? "<span id='album-slideshow-link' class='unselected'><a href='{$slideshowLink}'>Slideshow</a></span>" : "") . "<span class='selected'>{$batch} / " . $numAlbums . " " . gettext($this->getAlbumTabText($numAlbums)) . "</span>" . ($this->getNumImages() > 0 ? "<span class='unselected last'><a href='" . $this->getImageTabLink() . "'>" . $this->getNumImages() . " " . gettext("images") . "</a></span>" : "<span class='unselected last'>" . $this->getNumImages() . " " . gettext("image") . "</span>") . "</div>" . $subalbums;
if ($this->showRandomImage()) {
$img = $this->getRandomAlbumImage();
$subalbums .= "<div id='random-album-image'>";
$previous = $_zp_current_image;
$_zp_current_image = $img;
$size = getSizeCustomImage(NULL, $w + 2);
$small = getCustomImageURL(NULL, $w + 2);
$width = $img->getWidth();
$height = $img->getHeight();
$ratio = ($w + 2) / $width;
$height = $height * $ratio;
$subalbums .= "<img src='{$small}' width='" . ($w + 2) . "' height='{$height}'/>";
$subalbums .= "<div class='caption'>Random selection</div>";
$subalbums .= "</div>";
$_zp_current_image = $previous;
}
return $subalbums;
}