当前位置: 首页>>代码示例>>PHP>>正文


PHP getAlbumFolder函数代码示例

本文整理汇总了PHP中getAlbumFolder函数的典型用法代码示例。如果您正苦于以下问题:PHP getAlbumFolder函数的具体用法?PHP getAlbumFolder怎么用?PHP getAlbumFolder使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getAlbumFolder函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: accessAlbums

function accessAlbums($attr, $path, $data, $volume)
{
    //	restrict access to his albums
    $base = explode('/', str_replace(getAlbumFolder(SERVERPATH), '', str_replace('\\', '/', $path) . '/'));
    $base = array_shift($base);
    $block = !$base && $attr == 'write';
    if ($block || access($attr, $path, $data, $volume)) {
        return !($attr == 'read' || $attr == 'write');
    }
    return NULL;
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:11,代码来源:connector_zp.php

示例2: getPlayerConfig

    /**
     * Prints the JS configuration of flv player
     *
     * @param string $moviepath the direct path of a movie (within the slideshow), if empty (within albums) the zenphoto function getUnprotectedImageURL() is used
     * @param string $imagetitle the title of the movie to be passed to the player for display (within slideshow), if empty (within albums) the function getImageTitle() is used
     * @param string $count unique text for when there are multiple player items on a page
     */
    function getPlayerConfig($moviepath = '', $imagetitle = '', $count = '')
    {
        global $_zp_current_image, $_zp_current_album;
        if (empty($moviepath)) {
            $moviepath = getUnprotectedImageURL();
            $ext = strtolower(strrchr(getUnprotectedImageURL(), "."));
        } else {
            $ext = strtolower(strrchr($moviepath, "."));
        }
        if (empty($imagetitle)) {
            $imagetitle = getImageTitle();
        }
        if (!empty($count)) {
            $count = "-" . $count;
        }
        $imgextensions = array(".jpg", ".jpeg", ".gif", ".png");
        if (is_null($_zp_current_image)) {
            $albumfolder = $moviepath;
            $filename = $imagetitle;
            $videoThumb = '';
        } else {
            $album = $_zp_current_image->getAlbum();
            $albumfolder = $album->name;
            $filename = $_zp_current_image->filename;
            $videoThumb = checkObjectsThumb(getAlbumFolder() . $albumfolder, $filename);
            if (!empty($videoThumb)) {
                $videoThumb = getAlbumFolder(WEBPATH) . $albumfolder . '/' . $videoThumb;
            }
        }
        $output = '';
        $output .= '<p id="player' . $count . '"><a href="http://www.macromedia.com/go/getflashplayer">' . gettext("Get Flash") . '</a> to see this player.</p>
			<script type="text/javascript">';
        if ($ext === ".mp3" and !isset($videoThumb)) {
            $output .= '	var so = new SWFObject("' . WEBPATH . '/' . ZENFOLDER . '/plugins/flvplayer/' . getOption("flv_player_version") . '.swf","player' . $count . '","' . getOption('flv_player_width') . '","' . FLV_PLAYER_MP3_HEIGHT . '","7");';
        } else {
            $output .= '	var so = new SWFObject("' . WEBPATH . '/' . ZENFOLDER . '/plugins/flvplayer/' . getOption("flv_player_version") . '.swf","player' . $count . '","' . getOption('flv_player_width') . '","' . getOption('flv_player_height') . '","7");';
            $output .= 'so.addVariable("displayheight","' . getOption('flv_player_displayheight') . '");';
        }
        $output .= 'so.addParam("allowfullscreen","true");
			so.addVariable("file","' . $moviepath . '&amp;title=' . strip_tags($imagetitle) . '");
			' . (!empty($videoThumb) ? 'so.addVariable("image","' . $videoThumb . '")' : '') . '
			so.addVariable("backcolor","' . getOption('flv_player_backcolor') . '");
			so.addVariable("frontcolor","' . getOption('flv_player_frontkcolor') . '");
			so.addVariable("lightcolor","' . getOption('flv_player_lightcolor') . '");
			so.addVariable("screencolor","' . getOption('flv_player_screencolor') . '");
			so.addVariable("autostart","' . (getOption('flv_player_autostart') ? 'true' : 'false') . '");
			so.addVariable("overstretch","true");
			so.addVariable("bufferlength","' . getOption('flv_player_buffer') . '");
			so.addVariable("controlbar","' . getOption('flv_player_controlbar') . '");
			so.write("player' . $count . '");
			</script>';
        return $output;
    }
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:60,代码来源:flvplayer.php

示例3: createAlbumZip

/**
 * Creates a zip file of the album
 *
 * @param string $album album folder
 */
function createAlbumZip($album)
{
    global $_zp_zip_list;
    if (!checkAlbumPassword($album, $hint)) {
        pageError();
        exit;
    }
    $album = UTF8ToFilesystem($album);
    $rp = realpath(getAlbumFolder() . $album) . '/';
    $p = $album . '/';
    include_once 'archive.php';
    $dest = realpath(getAlbumFolder()) . '/' . urlencode($album) . ".zip";
    $persist = getOption('persistent_archive');
    if (!$persist || !file_exists($dest)) {
        if (file_exists($dest)) {
            unlink($dest);
        }
        $z = new zip_file($dest);
        $z->set_options(array('basedir' => $rp, 'inmemory' => 0, 'recurse' => 0, 'storepaths' => 1));
        if ($dh = opendir($rp)) {
            $_zp_zip_list[] = '*.*';
            while (($file = readdir($dh)) !== false) {
                if ($file != '.' && $file != '..') {
                    if (is_dir($rp . $file)) {
                        $base_a = explode("/", $album);
                        unset($base_a[count($base_a) - 1]);
                        $base = implode('/', $base_a);
                        zipAddSubalbum($rp, $base, $file, $z);
                    }
                }
            }
            closedir($dh);
        }
        $z->add_files($_zp_zip_list);
        $z->create_archive();
    }
    header('Content-Type: application/zip');
    header('Content-Disposition: attachment; filename="' . urlencode($album) . '.zip"');
    header("Content-Length: " . filesize($dest));
    printLargeFileContents($dest);
    if (!$persist) {
        unlink($dest);
    }
}
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:49,代码来源:album-zip.php

示例4: getOptionsSupported

 function getOptionsSupported()
 {
     global $_zp_supported_images, $_zp_extra_filetypes, $mysetoptions;
     $albums = $this->loadAlbumNames(getAlbumFolder());
     $albums = array_unique($albums);
     natsort($albums);
     $lista = array();
     foreach ($albums as $album) {
         $lista[$album] = 'filter_file_searches_albums_' . $album;
     }
     natsort($_zp_supported_images);
     $types = array_keys($_zp_extra_filetypes);
     natsort($types);
     $list = array_merge($_zp_supported_images, $types);
     $listi = array();
     foreach ($list as $suffix) {
         $listi[$suffix] = 'filter_file_searches_images_' . $suffix;
     }
     return array(gettext('Albums') => array('key' => 'filter_file_searches_albums', 'type' => 7, 'checkboxes' => $lista, 'currentvalues' => $mysetoptions, 'desc' => gettext("Check album names to be ignored.")), gettext('Images') => array('key' => 'filter_file_searches_images', 'type' => 7, 'checkboxes' => $listi, 'currentvalues' => $mysetoptions, 'desc' => gettext('Check image suffixes to be ingnored.')));
 }
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:20,代码来源:filter-file_searches.php

示例5: getImageRotation

function getImageRotation($imgfile)
{
    $imgfile = substr($imgfile, strlen(getAlbumFolder()));
    $result = query_single_row('SELECT EXIFOrientation FROM ' . prefix('images') . ' AS i JOIN ' . prefix('albums') . ' as a ON i.albumid = a.id WHERE "' . $imgfile . '" = CONCAT(a.folder,"/",i.filename)');
    if (is_array($result) && array_key_exists('EXIFOrientation', $result)) {
        $splits = preg_split('/!([(0-9)])/', $result['EXIFOrientation']);
        $rotation = $splits[0];
        switch ($rotation) {
            case 1:
                return false;
                break;
            case 2:
                return false;
                break;
                // mirrored
            // mirrored
            case 3:
                return 180;
                break;
                // upsidedown (not 180 but close)
            // upsidedown (not 180 but close)
            case 4:
                return 180;
                break;
                // upsidedown mirrored
            // upsidedown mirrored
            case 5:
                return 270;
                break;
                // 90 CW mirrored (not 270 but close)
            // 90 CW mirrored (not 270 but close)
            case 6:
                return 270;
                break;
                // 90 CCW
            // 90 CCW
            case 7:
                return 90;
                break;
                // 90 CCW mirrored (not 90 but close)
            // 90 CCW mirrored (not 90 but close)
            case 8:
                return 90;
                break;
                // 90 CW
            // 90 CW
            default:
                return false;
        }
    }
    return false;
}
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:52,代码来源:functions-image.php

示例6: getFullImage

 /**
  * Returns a path to the original image in the original folder.
  *
  * @param string $path the "path" to the image. Defaults to the simple WEBPATH
  *
  * @return string
  */
 function getFullImage($path = WEBPATH)
 {
     return getAlbumFolder($path) . $this->album->name . "/" . $this->filename;
 }
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:11,代码来源:class-image.php

示例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>";
}
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:76,代码来源:image_album_statistics.php

示例8: getThumbImageFile

 /**
  * Returns the image file name for the thumbnail image.
  *
  * @return string
  */
 function getThumbImageFile()
 {
     if ($this->objectsThumb != NULL) {
         $imgfile = getAlbumFolder() . $this->album->name . '/' . $this->objectsThumb;
     } else {
         $imgfile = SERVERPATH . '/' . THEMEFOLDER . '/' . UTF8ToFilesystem($this->album->gallery->getCurrentTheme()) . '/images/multimediaDefault.png';
         if (!file_exists($imgfile)) {
             $imgfile = SERVERPATH . "/" . ZENFOLDER . PLUGIN_FOLDER . substr(basename(__FILE__), 0, -4) . '/multimediaDefault.png';
         }
     }
     return $imgfile;
 }
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:17,代码来源:class-video.php

示例9: array

$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";
        // As documentated on the fvl player's site movies and mp3 have are called via differently relative urls...
        // http://www.jeroenwijering.com/?item=Supported_Playlists
        if ($ext == ".flv" or $ext == ".mp4") {
            echo "\t\t<location>../../" . getAlbumFolder('') . $album->name . "/" . $item . "</location>\n";
        } else {
            echo "\t\t<location>.." . getAlbumFolder('') . $album->name . "/" . $item . "</location>\n";
        }
        echo "\t\t<image>" . $videoThumb . "</image>\n";
        echo "\t\t<info>../../" . WEBPATH . '/' . getAlbumFolder('') . $item . "</info>\n";
        echo "\t</track>\n";
    }
}
echo "</trackList>\n";
echo "</playlist>\n";
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:31,代码来源:playlist.php

示例10: preg_match_all

                preg_match_all('~\\<img.*src\\s*=\\s*"((\\.|[^"])*)~', $row[$field], $matches);
                foreach ($matches[1] as $key => $match) {
                    $updated = false;
                    if (preg_match('~/' . CACHEFOLDER . '/~', $match)) {
                        $found++;
                        list($image, $args) = getImageProcessorURIFromCacheName($match, $watermarks);
                        $try = $_zp_supported_images;
                        $base = stripSuffix($image);
                        $prime = getSuffix($image);
                        array_unshift($try, $prime);
                        $try = array_unique($try);
                        $missing = true;
                        //see if we can match the cache name to an image in the album.
                        //Note that the cache suffix may not match the image suffix
                        foreach ($try as $suffix) {
                            if (file_exists(getAlbumFolder() . $base . '.' . $suffix)) {
                                $missing = false;
                                $image = $base . '.' . $suffix;
                                $uri = getImageURI($args, dirname($image), basename($image), NULL);
                                if (strpos($uri, 'i.php?') !== false) {
                                    $fixed++;
                                    $title = getTitle($table, $row);
                                    ?>
											<a href="<?php 
                                    echo html_encode($uri);
                                    ?>
&amp;debug" title="<?php 
                                    echo $title;
                                    ?>
">
												<?php 
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:cacheDBImages.php

示例11: getCounterpartfile

 function getCounterpartfile($moviepath, $ext, $definition)
 {
     $counterpartFile = '';
     $counterpart = str_replace("mp4", $ext, $moviepath);
     $albumPath = substr(ALBUM_FOLDER_WEBPATH, strlen(WEBPATH));
     $vidPath = getAlbumFolder() . str_replace(FULLWEBPATH . $albumPath, "", $counterpart);
     switch (strtoupper($definition)) {
         case "HD":
             if (file_exists($vidPath)) {
                 $counterpartFile = '<source src="' . pathurlencode($counterpart) . '" label="HD" />';
             }
             break;
         case "SD":
             $vidPath = str_replace(rtrim(getAlbumFolder(), "/"), rtrim(getAlbumFolder(), "/") . ".SD", $vidPath);
             $counterpart = str_replace(rtrim(ALBUM_FOLDER_WEBPATH, "/"), rtrim(ALBUM_FOLDER_WEBPATH, "/") . ".SD", $counterpart);
             if (file_exists($vidPath)) {
                 $counterpartFile = '<source src="' . pathurlencode($counterpart) . '" label="SD" />';
             }
             break;
     }
     return $counterpartFile;
 }
开发者ID:JimBrown,项目名称:VideoJS,代码行数:22,代码来源:VideoJS.php

示例12: while

     break;
 }
 // process these photos
 while ($r = mysql_fetch_array($result)) {
     // get album infos
     $id = $r['albumid'];
     if ($albumnr != "") {
         $sql = "SELECT * FROM " . prefix("albums") . " WHERE `show` = 1 AND id = {$albumnr}";
     } else {
         $sql = "SELECT * FROM " . prefix("albums") . " WHERE `show` = 1 AND id = {$id}";
     }
     $album = mysql_query($sql);
     $a = mysql_fetch_array($album);
     // sanitize database
     if (!file_exists(getAlbumFolder() . $a['folder'] . "/" . $r['filename'])) {
         echo '<!-- file ' . getAlbumFolder() . $a['folder'] . "/" . $r['filename'] . ' doesnt exist-->';
         $sql = "DELETE FROM " . prefix("images") . " WHERE id = " . $r['id'];
         mysql_query($sql);
         continue;
     }
     // check if new post : first photo, or album changed, or more than 1 hour between two photos
     if (!isset($preva) || $preva['id'] != $a['id'] || $prevr['mtime'] - $r['mtime'] > $skiptime) {
         // check if this first photo of the post is older than 1 hour
         $skip = $mtime_now - $r['mtime'] <= $skiptime + 1;
         // begin new post
         if (!$skip) {
             $nentries++;
             if ($nentries > $items) {
                 break;
             }
             $nphotos = 0;
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:31,代码来源:rss.3.php

示例13: rewrite_get_album_image

/**
 * rewrite_get_album_image - Fix special characters in the album and image names if mod_rewrite is on:
 * This is redundant and hacky; we need to either make the rewriting completely internal,
 * or fix the bugs in mod_rewrite. The former is probably a good idea.
 *
 *  Old explanation:
 *    rewrite_get_album_image() parses the album and image from the requested URL
 *    if mod_rewrite is on, and replaces the query variables with corrected ones.
 *    This is because of bugs in mod_rewrite that disallow certain characters.
 *
 * @param string $albumvar "$_GET" parameter for the album
 * @param string $imagevar "$_GET" parameter for the image
 */
function rewrite_get_album_image($albumvar, $imagevar)
{
    if (getOption('mod_rewrite')) {
        $uri = urldecode(sanitize($_SERVER['REQUEST_URI'], 0));
        $path = substr($uri, strlen(WEBPATH) + 1);
        // Only extract the path when the request doesn't include the running php file (query request).
        if (strlen($path) > 0 && strpos($_SERVER['REQUEST_URI'], $_SERVER['PHP_SELF']) === false && isset($_GET[$albumvar])) {
            $im_suffix = getOption('mod_rewrite_image_suffix');
            $suf_len = strlen($im_suffix);
            $qspos = strpos($path, '?');
            if ($qspos !== false) {
                $path = substr($path, 0, $qspos);
            }
            // Strip off the image suffix (could interfere with the rest, needs to go anyway).
            if ($suf_len > 0 && substr($path, -$suf_len) == $im_suffix) {
                $path = substr($path, 0, -$suf_len);
            }
            if (substr($path, -1, 1) == '/') {
                $path = substr($path, 0, strlen($path) - 1);
            }
            $pagepos = strpos($path, '/page/');
            $slashpos = strrpos($path, '/');
            $imagepos = strpos($path, '/image/');
            $albumpos = strpos($path, '/album/');
            if ($imagepos !== false) {
                $ralbum = substr($path, 0, $imagepos);
                $rimage = substr($path, $slashpos + 1);
            } else {
                if ($albumpos !== false) {
                    $ralbum = substr($path, 0, $albumpos);
                    $rimage = substr($path, $slashpos + 1);
                } else {
                    if ($pagepos !== false) {
                        $ralbum = substr($path, 0, $pagepos);
                        $rimage = null;
                    } else {
                        if ($slashpos !== false) {
                            $ralbum = substr($path, 0, $slashpos);
                            $rimage = substr($path, $slashpos + 1);
                            if (is_dir(getAlbumFolder() . UTF8ToFilesystem($ralbum . '/' . $rimage)) || hasDyanmicAlbumSuffix($rimage)) {
                                $ralbum = $ralbum . '/' . $rimage;
                                $rimage = null;
                            }
                        } else {
                            $ralbum = $path;
                            $rimage = null;
                        }
                    }
                }
            }
            return array($ralbum, $rimage);
        }
    }
    // No mod_rewrite, or no album, etc. Just send back the query args.
    $ralbum = isset($_GET[$albumvar]) ? sanitize_path($_GET[$albumvar]) : null;
    $rimage = isset($_GET[$imagevar]) ? sanitize_path($_GET[$imagevar]) : null;
    return array($ralbum, $rimage);
}
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:71,代码来源:functions-basic.php

示例14: garbageCollect

 /**
  * For every image in the album, look for its file. Delete from the database
  * if the file does not exist. Same for each sub-directory/album.
  *
  * @param bool $deep set to true for a thorough cleansing
  */
 function garbageCollect($deep = false)
 {
     if (is_null($this->images)) {
         $this->getImages();
     }
     $result = query("SELECT * FROM " . prefix('images') . " WHERE `albumid` = '" . $this->id . "'");
     $dead = array();
     $live = array();
     $files = $this->loadFileNames();
     // Does the filename from the db row match any in the files on disk?
     while ($row = mysql_fetch_assoc($result)) {
         if (!in_array($row['filename'], $files)) {
             // In the database but not on disk. Kill it.
             $dead[] = $row['id'];
         } else {
             if (in_array($row['filename'], $live)) {
                 // Duplicate in the database. Kill it.
                 $dead[] = $row['id'];
                 // Do something else here? Compare titles/descriptions/metadata/update dates to see which is the latest?
             } else {
                 $live[] = $row['filename'];
             }
         }
     }
     if (count($dead) > 0) {
         $sql = "DELETE FROM " . prefix('images') . " WHERE `id` = '" . array_pop($dead) . "'";
         $sql2 = "DELETE FROM " . prefix('comments') . " WHERE `type`='albums' AND `ownerid` = '" . array_pop($dead) . "'";
         foreach ($dead as $id) {
             $sql .= " OR `id` = '{$id}'";
             $sql2 .= " OR `ownerid` = '{$id}'";
         }
         query($sql);
         query($sql2);
     }
     // Get all sub-albums and make sure they exist.
     $result = query("SELECT * FROM " . prefix('albums') . " WHERE `folder` LIKE '" . mysql_real_escape_string($this->name) . "/%'");
     $dead = array();
     $live = array();
     // Does the dirname from the db row exist on disk?
     while ($row = mysql_fetch_assoc($result)) {
         if (!is_dir(getAlbumFolder() . UTF8ToFilesystem($row['folder'])) || in_array($row['folder'], $live) || substr($row['folder'], -1) == '/' || substr($row['folder'], 0, 1) == '/') {
             $dead[] = $row['id'];
         } else {
             $live[] = $row['folder'];
         }
     }
     if (count($dead) > 0) {
         $sql = "DELETE FROM " . prefix('albums') . " WHERE `id` = '" . array_pop($dead) . "'";
         $sql2 = "DELETE FROM " . prefix('comments') . " WHERE `type`='albums' AND `ownerid` = '" . array_pop($dead) . "'";
         foreach ($dead as $albumid) {
             $sql .= " OR `id` = '{$albumid}'";
             $sql2 .= " OR `ownerid` = '{$albumid}'";
         }
         query($sql);
         query($sql2);
     }
     if ($deep) {
         foreach ($this->getSubAlbums(0) as $dir) {
             $subalbum = new Album($this->gallery, $dir);
             // Could have been deleted if it didn't exist above...
             if ($subalbum->exists) {
                 $subalbum->garbageCollect($deep);
             }
         }
     }
 }
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:72,代码来源:class-album.php

示例15: getFullImage

 /**
  * Returns a path to the original image in the original folder.
  *
  * @param string $path the "path" to the image. Defaults to the simple WEBPATH
  *
  * @return string
  */
 protected function getFullImage($path = WEBPATH)
 {
     global $_zp_conf_vars;
     if ($path == WEBPATH && $_zp_conf_vars['album_folder_class'] == 'external') {
         return false;
     }
     if (is_array($this->filename)) {
         $album = dirname($this->filename['source']);
         $image = basename($this->filename['source']);
     } else {
         $album = $this->imagefolder;
         $image = $this->filename;
     }
     return getAlbumFolder($path) . $album . "/" . $image;
 }
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:22,代码来源:class-image.php


注:本文中的getAlbumFolder函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。