本文整理汇总了PHP中Album::getImages方法的典型用法代码示例。如果您正苦于以下问题:PHP Album::getImages方法的具体用法?PHP Album::getImages怎么用?PHP Album::getImages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Album
的用法示例。
在下文中一共展示了Album::getImages方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSubalbumImages
function getSubalbumImages($folder)
{
global $imagelist;
if (hasDyanmicAlbumSuffix($folder)) {
return;
}
$album = new Album($gallery, $folder);
$images = $album->getImages();
foreach ($images as $image) {
$imagelist[] = '/' . $folder . '/' . $image;
}
$albums = $album->getSubalbums();
foreach ($albums as $folder) {
getSubalbumImages($folder);
}
}
示例2: printSlideShow
static function printSlideShow($heading = true, $speedctl = false, $albumobj = "", $imageobj = "", $width = "", $height = "")
{
if (!isset($_POST['albumid']) and !is_object($albumobj)) {
echo "<div class=\"errorbox\" id=\"message\"><h2>" . gettext("Invalid linking to the slideshow page.") . "</h2></div>";
echo "</div></body></html>";
exit;
}
global $_zp_flash_player, $_zp_current_image, $_zp_current_album, $_zp_gallery;
//getting the image to start with
if (!empty($_POST['imagenumber']) and !is_object($imageobj)) {
$imagenumber = $_POST['imagenumber'] - 1;
// slideshows starts with 0, but zp with 1.
} elseif (is_object($imageobj)) {
makeImageCurrent($imageobj);
$imagenumber = imageNumber() - 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 = 0;
}
// getting the number of images
if (!empty($_POST['numberofimages'])) {
$numberofimages = sanitize_numeric($_POST['numberofimages']);
} elseif (is_object($albumobj)) {
$numberofimages = $albumobj->getNumImages();
}
//getting the album to show
if (!empty($_POST['albumid']) and !is_object($albumobj)) {
$albumid = sanitize_numeric($_POST['albumid']);
} elseif (is_object($albumobj)) {
$albumid = $albumobj->id;
} else {
$albumid = -1;
}
// setting the image size
if (!empty($width) and !empty($height)) {
$width = sanitize_numeric($width);
$height = sanitize_numeric($height);
} else {
$width = getOption("slideshow_width");
$height = getOption("slideshow_height");
}
$option = getOption("slideshow_mode");
// jQuery Cycle slideshow config
// get slideshow data
$gallery = new Gallery();
if ($albumid <= 0) {
// search page
$dynamic = 2;
$search = new SearchEngine();
$params = $_POST['preserve_search_params'];
$search->setSearchParams($params);
$images = $search->getImages(0);
$searchwords = $search->words;
$searchdate = $search->dates;
$searchfields = $search->fields;
$page = $search->page;
if (empty($_POST['imagenumber'])) {
$albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . abs($albumid));
$album = new Album($gallery, $albumq['folder']);
$returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
//$returnpath = rewrite_path('/'.pathurlencode($album->name).'/page/'.$pagenumber,'/index.php?album='.urlencode($album->name).'&page='.$pagenumber);
} else {
$returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
}
$albumtitle = gettext('Search');
} else {
$albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . $albumid);
$album = new Album($gallery, $albumq['folder']);
$albumtitle = $album->getTitle();
if (!checkAlbumPassword($albumq['folder'], $hint)) {
echo gettext("This album is password protected!");
exit;
}
$dynamic = $album->isDynamic();
$images = $album->getImages(0);
// return path to get back to the page we called the slideshow from
if (empty($_POST['imagenumber'])) {
$returnpath = rewrite_path('/' . pathurlencode($album->name) . '/page/' . $pagenumber, '/index.php?album=' . urlencode($album->name) . '&page=' . $pagenumber);
} else {
$returnpath = rewrite_path('/' . pathurlencode($album->name) . '/' . rawurlencode($_POST['imagefile']) . getOption('mod_rewrite_image_suffix'), '/index.php?album=' . urlencode($album->name) . '&image=' . urlencode($_POST['imagefile']));
}
}
// slideshow display section
switch ($option) {
case "jQuery":
$validtypes = array('jpg', 'jpeg', 'gif', 'png', 'mov', '3gp');
?>
<script type="text/javascript">
$(document).ready(function(){
$(function() {
var ThisGallery = '<?php
echo html_encode($albumtitle);
?>
';
var ImageList = new Array();
//.........这里部分代码省略.........
示例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: prefix
<?php
/**
* xspf playlist for flv player
*
* @author Malte Müller (acrylian), Stephen Billard (sbillard)
* @version 1.0.5
* @package plugins
*/
header("content-type:text/xml;charset=utf-8");
require_once "../../zp-core/template-functions.php";
$albumid = sanitize_numeric($_GET["albumid"]);
$albumresult = query_single_row("SELECT folder from " . prefix('albums') . " WHERE id = " . $albumid);
$album = new Album(new Gallery(), $albumresult['folder']);
$playlist = $album->getImages();
echo "<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n";
echo "<title>Sample XSPF Playlist</title>";
echo "<info>http://www.what.de</info>";
echo "<annotation>An example of a playlist with commercial</annotation>";
echo "<trackList>\n";
$imgextensions = array(".jpg", ".jpeg", ".gif", ".png");
foreach ($playlist as $item) {
$image = newImage($album, $item);
$ext = strtolower(strrchr($item, "."));
if ($ext == ".flv" || $ext == ".mp3" || $ext == ".mp4") {
$videoThumb = $image->objectsThumb;
if (!empty($videoThumb)) {
$videoThumb = '../../' . getAlbumFolder('') . $album->name . "/" . $videoThumb;
}
echo "\t<track>\n";
echo "\t\t<title>" . $image->getTitle() . " (" . $ext . ")</title>\n";
示例5: sizeof
<form name="albumedit" AUTOCOMPLETE=OFF
action="?page=edit&action=save<?php
echo $albumdir;
?>
" method="POST">
<input type="hidden" name="totalalbums" value="<?php
echo sizeof($albums);
?>
" />
<?php
$currentalbum = 0;
foreach ($albums as $folder) {
$currentalbum++;
$album = new Album($gallery, $folder);
$images = $album->getImages();
echo "\n<!-- " . $album->name . " -->\n";
?>
<div class="innerbox" style="padding: 15px;">
<?php
printAlbumEditForm($currentalbum, $album);
?>
</div>
<br />
<?php
}
?>
</form>
</div>
<?php
示例6: getSitemapImages
/**
* currently this splitts only sitemaps for albums and its images. Spliting the images itself requires a major rework...
*
* Gets links to all images for all albums (album by album)
*
* @return string
*/
function getSitemapImages()
{
global $_zp_gallery, $sitemap_number;
$data = '';
$sitemap_locales = generateLanguageList();
$imagechangefreq = getOption('sitemap_changefreq_images');
$imagelastmod = getOption('sitemap_lastmod_images');
$limit = sitemap_getDBLimit(1);
$albums = array();
getSitemapAlbumList($_zp_gallery, $albums, 'passImages');
$offset = $sitemap_number - 1;
$albums = array_slice($albums, $offset, SITEMAP_CHUNK);
if ($albums) {
$data .= sitemap_echonl('<?xml version="1.0" encoding="UTF-8"?>');
$data .= sitemap_echonl('<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
foreach ($albums as $album) {
set_time_limit(120);
// Extend script timeout to allow for gathering the images.
$albumobj = new Album($_zp_gallery, $album['folder']);
$images = $albumobj->getImages();
// print plain images links if available
if ($images) {
foreach ($images as $image) {
$imageobj = newImage($albumobj, $image);
$ext = strtolower(strrchr($imageobj->filename, "."));
if (getOption('sitemap_google')) {
if ($ext == '.mp3' || $ext == '.txt' || $ext == '.html' || $ext == '.htm') {
// since the Google extensions do not cover audio we list mp3s extra to not exclude them!
$printimage = true;
} else {
$printimage = false;
}
} else {
$printimage = true;
}
if ($printimage) {
$date = sitemap_getDateformat($imageobj, $imagelastmod);
if (sitemap_multilingual()) {
foreach ($sitemap_locales as $locale) {
$path = FULLWEBPATH . '/' . rewrite_path($locale . '/' . pathurlencode($albumobj->name) . '/' . urlencode($imageobj->filename) . IM_SUFFIX, '?album=' . pathurlencode($albumobj->name) . '&image=' . urlencode($imageobj->filename), false);
$data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $path . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $imagechangefreq . "</changefreq>\n\t\t<priority>0.6</priority>\n\t</url>");
}
} else {
$path = FULLWEBPATH . '/' . rewrite_path(pathurlencode($albumobj->name) . '/' . urlencode($imageobj->filename) . IM_SUFFIX, '?album=' . pathurlencode($albumobj->name) . '&image=' . urlencode($imageobj->filename), false);
$data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $path . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $imagechangefreq . "</changefreq>\n\t\t<priority>0.6</priority>\n\t</url>");
}
}
}
}
}
$data .= sitemap_echonl('</urlset>');
// End off the <urlset> tag
}
return $data;
}
示例7: processAlbumBulkActions
/**
* Processes the check box bulk actions for albums
*
*/
function processAlbumBulkActions()
{
global $gallery;
$action = sanitize($_POST['checkallaction']);
$ids = $_POST['ids'];
$total = count($ids);
$message = NULL;
if ($action != 'noaction') {
if ($total > 0) {
if ($action == 'addtags' || $action == 'alltags') {
foreach ($_POST as $key => $value) {
$key = postIndexDecode($key);
if (substr($key, 0, 10) == 'mass_tags_') {
if ($value) {
$tags[] = substr($key, 10);
}
}
}
$tags = sanitize($tags, 3);
}
$n = 0;
foreach ($ids as $albumname) {
$n++;
$albumobj = new Album($gallery, $albumname);
switch ($action) {
case 'deleteall':
$albumobj->remove();
break;
case 'showall':
$albumobj->setShow(1);
break;
case 'hideall':
$albumobj->setShow(0);
break;
case 'commentson':
$albumobj->setCommentsAllowed(1);
break;
case 'commentsoff':
$albumobj->setCommentsAllowed(0);
break;
case 'resethitcounter':
$albumobj->set('hitcounter', 0);
break;
case 'addtags':
$mytags = array_unique(array_merge($tags, $albumobj->getTags()));
$albumobj->setTags($mytags);
break;
case 'cleartags':
$albumobj->setTags(array());
break;
case 'alltags':
$images = $albumobj->getImages();
foreach ($images as $imagename) {
$imageobj = newImage($albumobj, $imagename);
$mytags = array_unique(array_merge($tags, $imageobj->getTags()));
$imageobj->setTags($mytags);
$imageobj->save();
}
break;
case 'clearalltags':
$images = $albumobj->getImages();
foreach ($images as $imagename) {
$imageobj = newImage($albumobj, $imagename);
$imageobj->setTags(array());
$imageobj->save();
}
break;
}
$albumobj->save();
}
}
return $action;
}
}
示例8: getRandomImagesAlbum
/**
* Returns a randomly selected image from the album or its subalbums. (May be NULL if none exists)
*
* @param mixed $rootAlbum optional album object/folder from which to get the image.
* @param bool $daily set to true to change picture only once a day.
* @param bool $showunpublished set true to consider all images
*
* @return object
*/
function getRandomImagesAlbum($rootAlbum = NULL, $daily = false, $showunpublished = false)
{
global $_zp_current_album, $_zp_gallery, $_zp_current_search;
if (empty($rootAlbum)) {
$album = $_zp_current_album;
} else {
if (is_object($rootAlbum)) {
$album = $rootAlbum;
} else {
$album = new Album($_zp_gallery, $rootAlbum);
}
}
if ($daily && ($potd = getOption('picture_of_the_day:' . $album->name))) {
$potd = unserialize($potd);
if (date('Y-m-d', $potd['day']) == date('Y-m-d')) {
$rndalbum = new Album($_zp_gallery, $potd['folder']);
$image = newImage($rndalbum, $potd['filename']);
if ($image->exists) {
return $image;
}
}
}
$image = NULL;
if ($album->isDynamic()) {
$images = $album->getImages(0);
shuffle($images);
while (count($images) > 0) {
$result = array_pop($images);
if (is_valid_image($result['filename'])) {
$image = newImage(new Album(new Gallery(), $result['folder']), $result['filename']);
}
}
} else {
$albumfolder = $album->getFolder();
if ($album->isMyItem(LIST_RIGHTS) || $showunpublished) {
$imageWhere = '';
$albumNotWhere = '';
$albumInWhere = '';
} else {
$imageWhere = " AND " . prefix('images') . ".show=1";
$albumNotWhere = getProtectedAlbumsWhere();
$albumInWhere = prefix('albums') . ".show=1";
}
$query = "SELECT id FROM " . prefix('albums') . " WHERE ";
if ($albumInWhere) {
$query .= $albumInWhere . ' AND ';
}
$query .= "folder LIKE " . db_quote($albumfolder . '%');
$result = query_full_array($query);
if (is_array($result) && count($result) > 0) {
$albumInWhere = prefix('albums') . ".id in (";
foreach ($result as $row) {
$albumInWhere = $albumInWhere . $row['id'] . ", ";
}
$albumInWhere = ' AND ' . substr($albumInWhere, 0, -2) . ')';
$c = 0;
while (is_null($image) && $c < 10) {
$result = query_single_row('SELECT COUNT(*) AS row_count ' . ' FROM ' . prefix('images') . ', ' . prefix('albums') . ' WHERE ' . prefix('albums') . '.folder!="" AND ' . prefix('images') . '.albumid = ' . prefix('albums') . '.id ' . $albumInWhere . $albumNotWhere . $imageWhere);
$rand_row = rand(0, $result['row_count'] - 1);
$result = query_single_row('SELECT ' . prefix('images') . '.filename, ' . prefix('albums') . '.folder ' . ' FROM ' . prefix('images') . ', ' . prefix('albums') . ' WHERE ' . prefix('images') . '.albumid = ' . prefix('albums') . '.id ' . $albumInWhere . $albumNotWhere . $imageWhere . ' LIMIT ' . $rand_row . ', 1');
$imageName = $result['filename'];
if (is_valid_image($imageName)) {
$image = newImage(new Album(new Gallery(), $result['folder']), $imageName);
}
$c++;
}
}
}
if ($daily && is_object($image)) {
$potd = array('day' => time(), 'folder' => $result['folder'], 'filename' => $result['filename']);
setThemeOption('picture_of_the_day:' . $album->name, serialize($potd));
}
return $image;
}
示例9: garbageCollect
//.........这里部分代码省略.........
if (!empty($words)) {
if (empty($fields)) {
$fields = '&searchfields=tags';
}
}
$album->set('search_params', $words . $fields);
$album->set('thumb', $thumb);
}
$album->save();
zp_apply_filter('album_refresh', $album);
}
}
/* Delete all image entries that don't belong to an album at all. */
$albumids = query_full_array("SELECT `id` FROM " . prefix('albums'));
/* all the album IDs */
$idsofalbums = array();
foreach ($albumids as $row) {
$idsofalbums[] = $row['id'];
}
$imageAlbums = query_full_array("SELECT DISTINCT `albumid` FROM " . prefix('images'));
/* albumids of all the images */
$albumidsofimages = array();
foreach ($imageAlbums as $row) {
$albumidsofimages[] = $row['albumid'];
}
$orphans = array_diff($albumidsofimages, $idsofalbums);
/* albumids of images with no album */
if (count($orphans) > 0) {
/* delete dead images from the DB */
$firstrow = array_pop($orphans);
$sql = "DELETE FROM " . prefix('images') . " WHERE `albumid`='" . $firstrow . "'";
foreach ($orphans as $id) {
$sql .= " OR `albumid`='" . $id . "'";
}
query($sql);
// Then go into existing albums recursively to clean them... very invasive.
foreach ($this->getAlbums(0) as $folder) {
$album = new Album($this, $folder);
if (!$album->isDynamic()) {
if (is_null($album->getDateTime())) {
// see if we can get one from an image
$images = $album->getImages(0, 0, 'date', 'DESC');
if (count($images) > 0) {
$image = newImage($album, array_shift($images));
$album->setDateTime($image->getDateTime());
}
}
$album->garbageCollect(true);
$album->preLoad();
}
$album->save();
zp_apply_filter('album_refresh', $album);
}
}
}
/* Look for image records where the file no longer exists. While at it, check for images with IPTC data to update the DB */
$start = array_sum(explode(" ", microtime()));
// protect against too much processing.
if (!empty($restart)) {
$restartwhere = ' WHERE `id`>' . $restart . ' AND `mtime`=0';
} else {
$restartwhere = ' WHERE `mtime`=0';
}
define('RECORD_LIMIT', 5);
$sql = 'SELECT * FROM ' . prefix('images') . $restartwhere . ' ORDER BY `id` LIMIT ' . (RECORD_LIMIT + 2);
$images = query_full_array($sql);
if (count($images) > 0) {
$c = 0;
foreach ($images as $image) {
$sql = 'SELECT `folder` FROM ' . prefix('albums') . ' WHERE `id`="' . $image['albumid'] . '";';
$row = query_single_row($sql);
$imageName = internalToFilesystem(ALBUM_FOLDER_SERVERPATH . $row['folder'] . '/' . $image['filename']);
if (file_exists($imageName)) {
$mtime = filemtime($imageName);
if ($image['mtime'] != $mtime) {
// file has changed since we last saw it
$imageobj = newImage(new Album($this, $row['folder']), $image['filename']);
$imageobj->set('mtime', $mtime);
$imageobj->updateMetaData();
// prime the EXIF/IPTC fields
$imageobj->updateDimensions();
// update the width/height & account for rotation
$imageobj->save();
zp_apply_filter('image_refresh', $imageobj);
}
} else {
$sql = 'DELETE FROM ' . prefix('images') . ' WHERE `id`="' . $image['id'] . '";';
$result = query($sql);
$sql = 'DELETE FROM ' . prefix('comments') . ' WHERE `type` IN (' . zp_image_types('"') . ') AND `ownerid` ="' . $image['id'] . '";';
$result = query($sql);
}
if (++$c >= RECORD_LIMIT) {
return $image['id'];
// avoide excessive processing
}
}
}
}
return false;
}
示例10: printAlbumEditForm
//.........这里部分代码省略.........
echo "\n<td>";
$showThumb = getOption('thumb_select_images');
if ($showThumb) {
echo "\n<script type=\"text/javascript\">updateThumbPreview(document.getElementById('thumbselect'));</script>";
}
echo "\n<select id=\"\"";
if ($showThumb) {
echo " class=\"thumbselect\" onChange=\"updateThumbPreview(this)\"";
}
echo " name=\"" . $prefix . "thumb\">";
$thumb = $album->get('thumb');
echo "\n<option";
if ($showThumb) {
echo " class=\"thumboption\" value=\"\" style=\"background-color:#B1F7B6\"";
}
if ($thumb === '1') {
echo " selected=\"selected\"";
}
echo ' value="1">' . gettext('most recent');
echo '</option>';
echo "\n<option";
if ($showThumb) {
echo " class=\"thumboption\" value=\"\" style=\"background-color:#B1F7B6\"";
}
if (empty($thumb) && $thumb !== '1') {
echo " selected=\"selected\"";
}
echo ' value="">' . gettext('randomly selected');
echo '</option>';
if ($album->isDynamic()) {
$params = $album->getSearchParams();
$search = new SearchEngine();
$search->setSearchParams($params);
$images = $search->getImages(0);
$thumb = $album->get('thumb');
$imagelist = array();
foreach ($images as $imagerow) {
$folder = $imagerow['folder'];
$filename = $imagerow['filename'];
$imagelist[] = '/' . $folder . '/' . $filename;
}
if (count($imagelist) == 0) {
$subalbums = $search->getAlbums(0);
foreach ($subalbums as $folder) {
$newalbum = new Album($gallery, $folder);
if (!$newalbum->isDynamic()) {
$images = $newalbum->getImages(0);
foreach ($images as $filename) {
$imagelist[] = '/' . $folder . '/' . $filename;
}
}
}
}
foreach ($imagelist as $imagepath) {
$list = explode('/', $imagepath);
$filename = $list[count($list) - 1];
unset($list[count($list) - 1]);
$folder = implode('/', $list);
$albumx = new Album($gallery, $folder);
$image = newImage($albumx, $filename);
$selected = $imagepath == $thumb;
echo "\n<option";
if ($showThumb) {
echo " class=\"thumboption\"";
echo " style=\"background-image: url(" . $image->getThumb() . "); background-repeat: no-repeat;\"";
}
示例11: 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) {
//.........这里部分代码省略.........