• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getSuffix函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: accessMedia

function accessMedia($attr, $path, $data, $volume)
{
    //allow only tinyMCE recognized media suffixes
    $valid = array("mp3", "wav", "mp4", "webm", "ogg", "swf");
    if (access($attr, $path, $data, $volume) || !is_dir($path) && !in_array(getSuffix($path), $valid)) {
        return !($attr == 'read' || $attr == 'write');
    }
    return NULL;
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:9,代码来源:connector_zp.php


示例2: getImageProcessorURIFromCacheName

function getImageProcessorURIFromCacheName($match, $watermarks)
{
    $args = array(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
    $set = array();
    $done = false;
    $params = explode('_', stripSuffix($match));
    while (!$done && count($params) > 1) {
        $check = array_pop($params);
        if (is_numeric($check) && !isset($set['w']) && !isset($set['h'])) {
            $set['s'] = $check;
            break;
        } else {
            $c = substr($check, 0, 1);
            if ($c == 'w' || $c == 'h') {
                if (is_numeric($v = substr($check, 1))) {
                    $set[$c] = (int) $v;
                    continue;
                }
            }
            if ($c == 'c') {
                $c = substr($check, 0, 2);
                if (is_numeric($v = substr($check, 2))) {
                    $set[$c] = (int) $v;
                    continue;
                }
            }
            if (!isset($set['w']) && !isset($set['h']) && !isset($set['s'])) {
                if (!isset($set['wm']) && in_array($check, $watermarks)) {
                    $set['wmk'] = $check;
                } else {
                    if ($check == 'thumb') {
                        $set['t'] = true;
                    } else {
                        $set['effects'] = $check;
                    }
                }
            } else {
                array_push($params, $check);
                break;
            }
        }
    }
    if (!isset($set['wmk'])) {
        $set['wmk'] = '!';
    }
    $image = preg_replace('~.*/' . CACHEFOLDER . '/~', '', implode('_', $params)) . '.' . getSuffix($match);
    //	strip out the obfustication
    $album = dirname($image);
    $image = preg_replace('~^[0-9a-f]{' . CACHE_HASH_LENGTH . '}\\.~', '', basename($image));
    $image = $album . '/' . $image;
    return array($image, getImageArgs($set));
}
开发者ID:rb26,项目名称:zenphoto,代码行数:52,代码来源:functions.php


示例3: zp_imageGet

 /**
  * Takes an image filename and returns a GD Image using the correct function
  * for the image's format (imagecreatefrom*). Supports JPEG, GIF, and PNG.
  * @param string $imagefile the full path and filename of the image to load.
  * @return image the loaded GD image object.
  *
  */
 function zp_imageGet($imgfile)
 {
     $ext = getSuffix($imgfile);
     switch ($ext) {
         case 'png':
             return imagecreatefrompng($imgfile);
         case 'wbmp':
             return imagecreatefromwbmp($imgfile);
         case 'jpeg':
         case 'jpg':
             return imagecreatefromjpeg($imgfile);
         case 'gif':
             return imagecreatefromgif($imgfile);
     }
     return false;
 }
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:23,代码来源:lib-GD.php


示例4: getPHPFiles

function getPHPFiles($folder, $exclude, &$files = array())
{
    $dir = opendir($folder);
    while (($file = readdir($dir)) !== false) {
        $file = str_replace('\\', '/', $file);
        if (strpos($file, '.') !== 0) {
            if (is_dir($folder . '/' . $file) && !in_array($file, $exclude)) {
                getPHPFiles($folder . '/' . $file, $exclude, $files);
            } else {
                if (getSuffix($file) == 'php') {
                    $entry = $folder . '/' . $file;
                    $files[] = $entry;
                }
            }
        }
    }
    closedir($dir);
    return $files;
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:19,代码来源:functions.php


示例5: getResidentFiles

/**
 *
 * enumerates the files in folder(s)
 * @param $folder
 */
function getResidentFiles($folder)
{
    global $_zp_resident_files;
    $localfiles = array();
    $localfolders = array();
    if (file_exists($folder)) {
        $dirs = scandir($folder);
        foreach ($dirs as $file) {
            if ($file[0] != '.') {
                $file = str_replace('\\', '/', $file);
                $key = $folder . '/' . $file;
                if (is_dir($folder . '/' . $file)) {
                    $localfolders = array_merge($localfolders, getResidentFiles($folder . '/' . $file));
                } else {
                    if (getSuffix($key) == 'php') {
                        $localfiles[] = $key;
                    }
                }
            }
        }
    }
    return array_merge($localfiles, $localfolders);
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:28,代码来源:legacyConverter.php


示例6: printjPlayerPlaylist

    /**
     * Prints a playlist using jPlayer. Several playlists per page supported.
     *
     * 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 printjPlayerPlaylist("playlist"); ?> or <?php printjPlayerPlaylist("playlist-audio"); ?>
     *
     * @param string $option "playlist" use for pure video and mixed video/audio playlists or if you want to show the poster/videothumb with audio only playlists,
     * 											 "playlist-audio" use for pure audio playlists (m4a,mp3,fla supported only) if you don't need the poster/videothumb to be shown only.
     * @param string $albumfolder album name to get a playlist from directly
     */
    function printjPlayerPlaylist($option = "playlist", $albumfolder = "")
    {
        global $_zp_current_album, $_zp_current_search;
        if (empty($albumfolder)) {
            if (in_context(ZP_SEARCH)) {
                $albumobj = $_zp_current_search;
            } else {
                $albumobj = $_zp_current_album;
            }
        } else {
            $albumobj = newAlbum($albumfolder);
        }
        $entries = $albumobj->getImages(0);
        if (($numimages = count($entries)) != 0) {
            switch ($option) {
                case 'playlist':
                    $suffixes = array('m4a', 'm4v', 'mp3', 'mp4', 'flv', 'fla');
                    break;
                case 'playlist-audio':
                    $suffixes = array('m4a', 'mp3', 'fla');
                    break;
                default:
                    //	an invalid option parameter!
                    return;
            }
            $id = $albumobj->getID();
            ?>
			<script type="text/javascript">
								//<![CDATA[
								$(document).ready(function(){
				new jPlayerPlaylist({
				jPlayer: "#jquery_jplayer_<?php 
            echo $id;
            ?>
",
								cssSelectorAncestor: "#jp_container_<?php 
            echo $id;
            ?>
"
				}, [
			<?php 
            $count = '';
            $number = '';
            foreach ($entries as $entry) {
                $count++;
                if (is_array($entry)) {
                    $ext = getSuffix($entry['filename']);
                } else {
                    $ext = getSuffix($entry);
                }
                $numbering = '';
                if (in_array($ext, $suffixes)) {
                    $number++;
                    if (getOption('jplayer_playlist_numbered')) {
                        $numbering = '<span>' . $number . '</span>';
                    }
                    $video = newImage($albumobj, $entry);
                    $videoThumb = '';
                    $this->setModeAndSuppliedFormat($ext);
                    if ($option == 'playlist' && getOption('jplayer_poster')) {
                        $videoThumb = ',poster:"' . $video->getCustomImage(null, $this->width, $this->height, $this->width, $this->height, null, null, true) . '"';
                    }
                    $playtime = '';
                    if (getOption('jplayer_playlist_playtime')) {
                        $playtime = ' (' . $video->get('VideoPlaytime') . ')';
                    }
                    ?>
						{
						title:"<?php 
                    echo $numbering . html_encode($video->getTitle()) . $playtime;
                    ?>
",
					<?php 
                    if (getOption('jplayer_download')) {
                        ?>
							free:true,
					<?php 
                    }
                    ?>
					<?php 
                    echo $this->supplied;
                    ?>
:"<?php 
                    echo html_encode(pathurlencode($url = $video->getFullImageURL(FULLWEBPATH)));
                    ?>
"
					<?php 
                    echo $this->getCounterpartFiles($url, $ext);
//.........这里部分代码省略.........
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:101,代码来源:jplayer.php


示例7: header

        $_zp_gallery_page = 'password.php';
        $_zp_script = $_zp_themeroot . '/password.php';
        if (!file_exists(internalToFilesystem($_zp_script))) {
            $_zp_script = SERVERPATH . '/' . ZENFOLDER . '/password.php';
        }
        header('Content-Type: text/html; charset=' . LOCAL_CHARSET);
        header("HTTP/1.0 302 Found");
        header("Status: 302 Found");
        header('Last-Modified: ' . ZP_LAST_MODIFIED);
        include internalToFilesystem($_zp_script);
        exposeZenPhotoInformations($_zp_script, array(), $theme);
        exitZP();
    }
}
$image_path = $imageobj->localpath;
$suffix = getSuffix($image_path);
switch ($suffix) {
    case 'wbm':
    case 'wbmp':
        $suffix = 'wbmp';
        break;
    case 'jpg':
        $suffix = 'jpeg';
        break;
    case 'png':
    case 'gif':
    case 'jpeg':
        break;
    default:
        if ($disposal == 'Download') {
            require_once dirname(__FILE__) . '/lib-MimeTypes.php';
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:full-image.php


示例8: isTextFile

function isTextFile($file)
{
    global $ok_extensions;
    $ext = strtolower(getSuffix($file));
    return in_array($ext, $ok_extensions);
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:6,代码来源:themes-editor.php


示例9: zp_apply_filter

     $album->setOwner($_zp_current_admin_obj->getUser());
     $album->save();
 }
 @chmod($targetPath, CHMOD_VALUE);
 $error = zp_apply_filter('check_upload_quota', UPLOAD_ERR_OK, $tempFile);
 if (!$error) {
     if (is_valid_image($name) || is_valid_other_type($name)) {
         $seoname = seoFriendly($name);
         if (strrpos($seoname, '.') === 0) {
             $seoname = sha1($name) . $seoname;
         }
         // soe stripped out all the name.
         $targetFile = $targetPath . '/' . internalToFilesystem($seoname);
         if (file_exists($targetFile)) {
             $append = '_' . time();
             $seoname = stripSuffix($seoname) . $append . '.' . getSuffix($seoname);
             $targetFile = $targetPath . '/' . internalToFilesystem($seoname);
         }
         if (move_uploaded_file($tempFile, $targetFile)) {
             @chmod($targetFile, 0666 & CHMOD_VALUE);
             $album = new Album($gallery, $folder);
             $image = newImage($album, $seoname);
             $image->setOwner($_zp_current_admin_obj->getUser());
             if ($name != $seoname && $image->getTitle() == substr($seoname, 0, strrpos($seoname, '.'))) {
                 $image->setTitle(substr($name, 0, strrpos($name, '.')));
             }
             $image->save();
         } else {
             $error = UPLOAD_ERR_NO_FILE;
         }
     } else {
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:31,代码来源:uploader.php


示例10: is_zip

/**
 * Checks for a zip file
 *
 * @param string $filename name of the file
 * @return bool
 */
function is_zip($filename)
{
    $ext = getSuffix($filename);
    return $ext == "zip";
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:11,代码来源:admin-functions.php


示例11: 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"?>');
        if (GOOGLE_SITEMAP) {
            $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" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">');
        } else {
            $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 = newAlbum($album['folder']);
            $images = $albumobj->getImages();
            // print plain images links if available
            if ($images) {
                foreach ($images as $image) {
                    $imageobj = newImage($albumobj, $image);
                    $ext = getSuffix($imageobj->filename);
                    $date = sitemap_getDateformat($imageobj, $imagelastmod);
                    switch (SITEMAP_LOCALE_TYPE) {
                        case 1:
                            foreach ($sitemap_locales as $locale) {
                                $path = seo_locale::localePath(true, $locale) . '/' . pathurlencode($albumobj->name) . '/' . urlencode($imageobj->filename) . IM_SUFFIX;
                                $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");
                                if (GOOGLE_SITEMAP) {
                                    $data .= getSitemapGoogleImageVideoExtras($albumobj, $imageobj, $locale);
                                }
                                $data .= sitemap_echonl("</url>");
                            }
                            break;
                        case 2:
                            foreach ($sitemap_locales as $locale) {
                                $path = rewrite_path(pathurlencode($albumobj->name) . '/' . urlencode($imageobj->filename) . IM_SUFFIX, '?album=' . pathurlencode($albumobj->name) . '&amp;image=' . urlencode($imageobj->filename), dynamic_locale::fullHostPath($locale));
                                $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");
                                if (GOOGLE_SITEMAP) {
                                    $data .= getSitemapGoogleImageVideoExtras($albumobj, $imageobj, $locale);
                                }
                                $data .= sitemap_echonl("</url>");
                            }
                            break;
                        default:
                            $path = rewrite_path(pathurlencode($albumobj->name) . '/' . urlencode($imageobj->filename) . IM_SUFFIX, '?album=' . pathurlencode($albumobj->name) . '&amp;image=' . urlencode($imageobj->filename), FULLWEBPATH);
                            $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");
                            if (GOOGLE_SITEMAP) {
                                $data .= getSitemapGoogleImageVideoExtras($albumobj, $imageobj, NULL);
                            }
                            $data .= sitemap_echonl("</url>");
                            break;
                    }
                }
            }
        }
        $data .= sitemap_echonl('</urlset>');
        // End off the <urlset> tag
    }
    return $data;
}
开发者ID:JoniWeiss,项目名称:JoniWebGirl,代码行数:75,代码来源:sitemap-extended.php


示例12: prefix

                }
            }
        }
        $sql = 'SELECT * FROM ' . prefix($table) . ' WHERE `' . $field . '` REGEXP "<img.*src\\s*=\\s*\\".*' . CACHEFOLDER . '((\\.|[^\\"])*)"';
        $result = query($sql);
        if ($result) {
            while ($row = db_fetch_assoc($result)) {
                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 
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:cacheDBImages.php


示例13: cacheImage


//.........这里部分代码省略.........
                        $watermark_image = getWatermarkPath($watermark_image);
                        if (!file_exists($watermark_image)) {
                            $watermark_image = SERVERPATH . '/' . ZENFOLDER . '/images/imageDefault.png';
                        }
                    }
                }
            }
        }
        if ($watermark_image) {
            $offset_h = getOption('watermark_h_offset') / 100;
            $offset_w = getOption('watermark_w_offset') / 100;
            $watermark = zp_imageGet($watermark_image);
            $watermark_width = zp_imageWidth($watermark);
            $watermark_height = zp_imageHeight($watermark);
            $imw = zp_imageWidth($newim);
            $imh = zp_imageHeight($newim);
            $nw = sqrt($imw * $imh * $percent * ($watermark_width / $watermark_height));
            $nh = $nw * ($watermark_height / $watermark_width);
            $percent = getOption('watermark_scale') / 100;
            $r = sqrt($imw * $imh * $percent / ($watermark_width * $watermark_height));
            if (!getOption('watermark_allow_upscale')) {
                $r = min(1, $r);
            }
            $nw = round($watermark_width * $r);
            $nh = round($watermark_height * $r);
            if ($nw != $watermark_width || $nh != $watermark_height) {
                $watermark = zp_imageResizeAlpha($watermark, $nw, $nh);
            }
            // Position Overlay in Bottom Right
            $dest_x = max(0, floor(($imw - $nw) * $offset_w));
            $dest_y = max(0, floor(($imh - $nh) * $offset_h));
            if (DEBUG_IMAGE) {
                debugLog("Watermark:" . basename($imgfile) . ": \$offset_h={$offset_h}, \$offset_w={$offset_w}, \$watermark_height={$watermark_height}, \$watermark_width={$watermark_width}, \$imw={$imw}, \$imh={$imh}, \$percent={$percent}, \$r={$r}, \$nw={$nw}, \$nh={$nh}, \$dest_x={$dest_x}, \$dest_y={$dest_y}");
            }
            zp_copyCanvas($newim, $watermark, $dest_x, $dest_y, 0, 0, $nw, $nh);
            zp_imageKill($watermark);
        }
        // Create the cached file (with lots of compatibility)...
        mkdir_recursive(dirname($newfile));
        if (zp_imageOutput($newim, getSuffix($newfile), $newfile, $quality)) {
            //	successful save of cached image
            if (getOption('ImbedIPTC') && getSuffix($newfilename) == 'jpg') {
                // the imbed function works only with JPEG images
                $iptc_data = zp_imageIPTC($imgfile);
                if (empty($iptc_data)) {
                    global $_zp_extra_filetypes;
                    //	because we are doing the require in a function!
                    if (!$_zp_extra_filetypes) {
                        $_zp_extra_filetypes = array();
                    }
                    require_once dirname(__FILE__) . '/functions.php';
                    //	it is ok to increase memory footprint now since the image processing is complete
                    $gallery = new Gallery();
                    $iptc = array('1#090' => chr(0x1b) . chr(0x25) . chr(0x47), '2#115' => $gallery->getTitle());
                    $imgfile = str_replace(ALBUM_FOLDER_SERVERPATH, '', $imgfile);
                    $imagename = basename($imgfile);
                    $albumname = dirname($imgfile);
                    $image = newImage(new Album(new Gallery(), $albumname), $imagename);
                    $copyright = $image->getCopyright();
                    if (empty($copyright)) {
                        $copyright = getOption('default_copyright');
                    }
                    if (!empty($copyright)) {
                        $iptc['2#116'] = $copyright;
                    }
                    $credit = $image->getCredit();
                    if (!empty($credit)) {
                        $iptc['2#110'] = $credit;
                    }
                    foreach ($iptc as $tag => $string) {
                        $tag_parts = explode('#', $tag);
                        $iptc_data .= iptc_make_tag($tag_parts[0], $tag_parts[1], $string);
                    }
                } else {
                    if (GRAPHICS_LIBRARY == 'Imagick' && IMAGICK_RETAIN_PROFILES) {
                        //	Imageick has preserved the metadata
                        $iptc_data = false;
                    }
                }
                if ($iptc_data) {
                    $content = iptcembed($iptc_data, $newfile);
                    $fw = fopen($newfile, 'w');
                    fwrite($fw, $content);
                    fclose($fw);
                    clearstatcache();
                }
            }
            if (DEBUG_IMAGE) {
                debugLog('Finished:' . basename($imgfile));
            }
        } else {
            if (DEBUG_IMAGE) {
                debugLog('cacheImage: failed to create ' . $newfile);
            }
        }
        @chmod($newfile, 0666 & CHMOD_VALUE);
        zp_imageKill($newim);
        zp_imageKill($im);
    }
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:101,代码来源:functions-image.php


示例14: new_image

 /**
  * Filter for handling image objects
  *
  * @param object $image
  * @return object
  */
 static function new_image($image)
 {
     global $_zp_exifvars;
     $source = '';
     $metadata_path = '';
     $files = safe_glob(substr($image->localpath, 0, strrpos($image->localpath, '.')) . '.*');
     if (count($files) > 0) {
         foreach ($files as $file) {
             if (strtolower(getSuffix($file)) == XMP_EXTENSION) {
                 $metadata_path = $file;
                 break;
             }
         }
     }
     if (!empty($metadata_path)) {
         $source = self::extractXMP(file_get_contents($metadata_path));
     } else {
         if (getOption('xmpMetadata_examine_images_' . strtolower(substr(strrchr($image->localpath, "."), 1)))) {
             $f = file_get_contents($image->localpath);
             $l = filesize($image->localpath);
             $abort = 0;
             $i = 0;
             while ($i < $l && $abort < 200 && !$source) {
                 $tag = bin2hex(substr($f, $i, 2));
                 $size = hexdec(bin2hex(substr($f, $i + 2, 2)));
                 switch ($tag) {
                     case 'ffe1':
                         // EXIF
                     // EXIF
                     case 'ffe2':
                         // EXIF extension
                     // EXIF extension
                     case 'fffe':
                         // COM
                     // COM
                     case 'ffe0':
                         // IPTC marker
                         $source = self::extractXMP($f);
                         $i = $i + $size + 2;
                         $abort = 0;
                         break;
                     default:
                         if ($f[$i] == '<') {
                             $source = self::extractXMP($f);
                         }
                         $i = $i + 1;
                         $abort++;
                         break;
                 }
             }
         }
     }
     if (!empty($source)) {
         $metadata = self::extract($source);
         $image->set('hasMetadata', count($metadata > 0));
         foreach ($metadata as $field => $element) {
             if (array_key_exists($field, $_zp_exifvars)) {
                 if (!$_zp_exifvars[$field][5]) {
                     continue;
                     //	the field has been disabled
                 }
             }
             $v = self::to_string($element);
             switch ($field) {
                 case 'EXIFDateTimeOriginal':
                     $image->setDateTime($element);
                     break;
                 case 'IPTCImageCaption':
                     $image->setDesc($v);
                     break;
                 case 'IPTCCity':
                     $image->setCity($v);
                     break;
                 case 'IPTCState':
                     $image->setState($v);
                     break;
                 case 'IPTCLocationName':
                     $image->setCountry($v);
                     break;
                 case 'IPTCSubLocation':
                     $image->setLocation($v);
                     break;
                 case 'EXIFExposureTime':
                     $v = formatExposure(self::rationalNum($element));
                     break;
                 case 'EXIFFocalLength':
                     $v = self::rationalNum($element) . ' mm';
                     break;
                 case 'EXIFAperatureValue':
                 case 'EXIFFNumber':
                     $v = 'f/' . self::rationalNum($element);
                     break;
                 case 'EXIFExposureBiasValue':
                 case 'EXIFGPSAltitude':
//.........这里部分代码省略.........
开发者ID:rb26,项目名称:zenphoto,代码行数:101,代码来源:xmpMetadata.php


示例15: getImageType

/**
 * Returns the object "type" of the "image".
 *
 * Note:
 * 	If the root object is a video object then
 * 	If a mediaplayer is enabled a sub-type of video or audio will
 * 	be determined from the suffix. If it is not one of the
 * 	known suffixes or if the mediaplayer is not enabled then 'other' is
 * 	returned as the object type.
 *
 * 	Pure images return empty for an object type.
 *
 * @return string
 */
function getImageType($imageobj)
{
    $imageType = strtolower(get_class($imageobj));
    switch ($imageType) {
        case 'video':
            $imagesuffix = getSuffix($imageobj->filename);
            switch ($imagesuffix) {
                case 'flv':
                case 'mp4':
                case 'm4v':
                    $imageType = 'video';
                    break;
                case 'mp3':
                case 'fla':
                case 'm4a':
                    $imageType = 'audio';
                    break;
            }
            break;
        case 'image':
            $imageType = '';
            break;
        default:
            $parent = strtolower(get_parent_class($imageobj));
            if ($parent == 'textobject') {
                $imageType = 'textobject';
            }
            break;
    }
    return $imageType;
}
开发者ID:rb26,项目名称:zenphoto,代码行数:45,代码来源:tinyzenpage-functions.php


示例16: getdownloadList

/**
 * Gets the actual download list included all subfolders and files
 * @param string $dir An optional different folder to generate the list that overrides the folder set on the option.
 * 										This could be a subfolder of the main download folder set on the plugin's options. You have to include the base directory as like this:
 * 										"folder" or "folder/subfolder" or "../folder"
 * 										You can also set any folder within or without the root of your Zenphoto installation as a download folder with this directly
 * @param string $listtype "ol" or "ul" for the type of HTML list you want to use
 * @param array $filters an array of files to exclude from the list. Standard items are '.', '..','.DS_Store','Thumbs.db','.htaccess','.svn'
 * @param array $excludesuffixes an array of file suffixes (without trailing dot to exclude from the list (e.g. "jpg")
 * @param string $sort 'asc" or "desc" (default) for alphabetical ascending or descending list
 * @return array
 */
function getdownloadList($dir, $filters, $excludesuffixes, $sort)
{
    if (empty($dir)) {
        $dir = getOption('downloadList_directory');
    }
    if (empty($excludesuffixes)) {
        $excludesuffixes = getOption('downloadList_excludesuffixes');
    }
    if (empty($excludesuffixes)) {
        $excludesuffixes = array();
    } elseif (!is_array($excludesuffixes)) {
        $excludesuffixes = explode(',', $excludesuffixes);
    }
    if ($sort == 'asc') {
        $direction = 0;
    } else {
        $direction = 1;
    }
    $dirs = array_diff(scandir($dir, $direction), array_merge(array('.', '..', '.DS_Store', 'Thumbs.db', '.htaccess', '.svn'), $filters));
    $dir_array = array();
    if ($sort == 'asc') {
        natsort($dirs);
    }
    foreach ($dirs as $file) {
        if (is_dir($dir . '/' . $file)) {
            $dir_array[$file] = getdownloadList($dir . "/" . $file, $filters, $excludesuffixes, $sort);
        } else {
            if (!in_array(getSuffix($file), $excludesuffixes)) {
                $dir_array[$file] = $dir . '/' . $file;
            }
        }
    }
    return $dir_array;
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:46,代码来源:downloadList.php


示例17: zp_imageGet

 /**
  * Takes an image filename and returns an Imagick image object
  *
  * @param string $imgfile the full path and filename of the image to load
  * @return Imagick
  */
 function zp_imageGet($imgfile)
 {
     global $_lib_Imagick_info;
     if (array_key_exists(strtoupper(getSuffix($imgfile)), $_lib_Imagick_info)) {
         $image = new Imagick();
         $maxHeight = getOption('magick_max_height');
         $maxWidth = getOption('magick_max_width');
         if ($maxHeight > lib_Imagick_Options::$ignore_size && $maxWidth > lib_Imagick_Options::$ignore_size) {
             $image->setOption('jpeg:size', $maxWidth . 'x' . $maxHeight);
         }
         $image->readImage(imgSrcURI($imgfile));
         //Generic CMYK to RGB conversion
         if ($image->getImageColorspace() == Imagick::COLORSPACE_CMYK) {
             $image->transformimagecolorspace(Imagick::COLORSPACE_SRGB);
         }
         return $image;
     }
     return false;
 }
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:25,代码来源:lib-Imagick.php


示例18: getItemGallery

 /**
  * Gets the feed item data in a gallery feed
  *
  * @param object $item Object of an image or album
  * @return array
  */
 protected function getItemGallery($item)
 {
     if ($this->mode == "albums") {
         $albumobj = newAlbum($item['folder']);
         $totalimages = $albumobj->getNumImages();
         $itemlink = $this->host . $albumobj->getLink();
         $thumb = $albumobj->getAlbumThumbImage();
         $thumburl = '<img border="0" src="' . PROTOCOL . '://' . $this->host . html_encode(pathurlencode($thumb->getCustomImage($this->imagesize, NULL, NULL, NULL, NULL, NULL, NULL, TRUE))) . '" alt="' . html_encode($albumobj->getTitle($this->locale)) . '" />';
         $title = $albumobj->getTitle($this->locale);
         if (true || $this->sortorder == "latestupdated") {
             $filechangedate = filectime(ALBUM_FOLDER_SERVERPATH . internalToFilesystem($albumobj->name));
             $latestimage = query_single_row("SELECT mtime FROM " . prefix('images') . " WHERE albumid = " . $albumobj->getID() . " AND `show` = 1 ORDER BY id DESC");
             if ($latestimage && $this->sortorder == 'latestupdated') {
                 $count = db_count('images', "WHERE albumid = " . $albumobj->getID() . " AND mtime = " . $latestimage['mtime']);
             } else {
                 $count = $totalimages;
             }
             if ($count != 0) {
                 $imagenumber = sprintf(ngettext('%s (%u image)', '%s (%u images)', $count), $title, $count);
             } else {
                 $imagenumber = $title;
             }
             $feeditem['desc'] = '<a title="' . $title . '" href="' . PROTOCOL . '://' . $itemlink . '">' . $thumburl . '</a>' . '<p>' . html_encode($imagenumber) . '</p>' . $albumobj->getDesc($this->locale) . '<br />' . sprintf(gettext("Last update: %s"), zpFormattedDate(DATE_FORMAT, $filechangedate));
         } else {
             if ($totalimages != 0) {
                 $imagenumber = sprintf(ngettext('%s (%u image)', '%s (%u images)', $totalimages), $title, $totalimages);
             }
             $feeditem['desc'] = '<a title="' . html_encode($title) . '" href="' . PROTOCOL . '://' . $itemlink . '">' . $thumburl . '</a>' . $item->getDesc($this->locale) . '<br />' . sprintf(gettext("Date: %s"), zpFormattedDate(DATE_FORMAT, $item->get('mtime')));
         }
         $ext = getSuffix($thumb->localpath);
     } else {
         $ext = getSuffix($item->localpath);
         $albumobj = $item->getAlbum();
         $itemlink = $this->host . $item->getLink();
         $fullimagelink = $this->host . html_encode(pathurlencode($item->getFullImageURL()));
         $thumburl = '<img border="0" src="' . PROTOCOL . '://' . $this->host . html_encode(pathurlencode($item->getCustomImage($this->imagesize, NULL, NULL, NULL, NULL, NULL, NULL, TRUE))) . '" alt="' . $item->getTitle($this->locale) . '" /><br />';
         $title = $item->getTitle($this->locale);
         $albumtitle = $albumobj->getTitle($this->locale);
         $datecontent = '<br />Date: ' . zpFormattedDate(DATE_FORMAT, $item->get('mtime'));
         if ($ext == "flv" || $ext == "mp3" || $ext == "mp4" || $ext == "3gp" || $ext == "mov" and $this->mode != "album") {
             $feeditem['desc'] = '<a title="' . html_encode($title) . ' in ' . html_encode($albumobj->getTitle($this->locale)) . '" href="' . PROTOCOL . '://' . $itemlink . '">' . $thumburl . '</a>' . $item->getDesc($this->locale) . $datecontent;
         } else {
             $feeditem['desc'] = '<a title="' . html_encode($title) . ' in ' . html_encode($albumobj->getTitle($this->locale)) . '" href="' . PROTOCOL . '://' . $itemlink . '"><img src="' . PROTOCOL . '://' . $this->host . html_encode(pathurlencode($item->getCustomImage($this->imagesize, NULL, NULL, NULL, NULL, NULL, NULL, TRUE))) . '" alt="' . html_encode($title) . '" /></a>' . $item->getDesc($this->locale) . $datecontent;
         }
     }
     // title
     if ($this->mode != "albums") {
         $feeditem['title'] = sprintf('%1$s (%2$s)', $item->getTitle($this->locale), $albumobj->getTitle($this->locale));
     } else {
         $feeditem['title'] = $imagenumber;
     }
     //link
     $feeditem['link'] = PROTOCOL . '://' . $itemlink;
     // enclosure
     $feeditem['enclosure'] = '';
     if (getOption("RSS_enclosure") and $this->mode != "albums") {
         $feeditem['enclosure'] = '<enclosure url="' . PROTOCOL . '://' . $fullimagelink . '" type="' . getMimeString($ext) . '" length="' . filesize($item->localpath) . '" />';
     }
     //category
     if ($this->mode != "albums") {
         $feeditem['category'] = html_encode($albumobj->getTitle($this->locale));
     } else {
         $feeditem['category'] = html_encode($albumobj->getTitle($this->locale));
     }
     //media content
     $feeditem['media_content'] = '';
     $feeditem['media_thumbnail'] = '';
     if (getOption("RSS_mediarss") and $this->mode != "albums") {
         $feeditem['media_content'] = '<media:content url="' . PROTOCOL . '://' . $fullimagelink . '" type="image/jpeg" />';
         $feeditem['media_thumbnail'] = '<media:thumbnail url="' . PROTOCOL . '://' . $fullimagelink . '" width="' . $this->imagesize . '"	height="' . $this->imagesize . '" />';
     }
     //date
     if ($this->mode != "albums") {
         $feeditem['pubdate'] = date("r", strtotime($item->getDateTime()));
     } else {
         $feeditem['pubdate'] = date("r", strtotime($albumobj->getDateTime()));
     }
     return $feeditem;
 }
开发者ID:JoniWeiss,项目名称:JoniWebGirl,代码行数:85,代码来源:rss.php


示例19: gettext

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getSurveyInfo函数代码示例发布时间:2022-05-15
下一篇:
PHP getSucursal函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap