當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Gallery::imageObjectClass方法代碼示例

本文整理匯總了PHP中Gallery::imageObjectClass方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gallery::imageObjectClass方法的具體用法?PHP Gallery::imageObjectClass怎麽用?PHP Gallery::imageObjectClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Gallery的用法示例。


在下文中一共展示了Gallery::imageObjectClass方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: newImage

/**
 * Returns a new "image" object based on the file extension
 *
 * @param object $album the owner album
 * @param string $filename the filename
 * @param bool $quiet set true to supress error messages (used by loadimage)
 * @return object
 */
function newImage($album, $filename = NULL, $quiet = false)
{
    global $_zp_missing_image;
    if (is_array($album)) {
        $xalbum = newAlbum($album['folder'], true, true);
        $filename = $album['filename'];
        $dyn = false;
    } else {
        if (is_array($filename)) {
            $xalbum = newAlbum($filename['folder'], true, true);
            $filename = $filename['filename'];
            $dyn = is_object($album) && $album->isDynamic();
        } else {
            if (is_object($album) && $album->isDynamic()) {
                $dyn = true;
                $album->getImages();
                $xalbum = array_keys($album->imageNames, $filename);
                $xalbum = array_shift($xalbum);
                $xalbum = newAlbum(dirname($xalbum), true, true);
            } else {
                $xalbum = $album;
                $dyn = false;
            }
        }
    }
    if (!is_object($xalbum) || !$xalbum->exists || !isAlbumClass($xalbum)) {
        $msg = sprintf(gettext('Bad album object parameter to newImage(%s)'), $filename);
    } else {
        if ($object = Gallery::imageObjectClass($filename)) {
            $image = new $object($xalbum, $filename, $quiet);
            if ($album && is_subclass_of($album, 'AlbumBase') && $dyn) {
                $image->albumname = $album->name;
                $image->albumlink = $album->linkname;
                $image->albumnamealbum = $album;
            }
            zp_apply_filter('image_instantiate', $image);
            if ($image->exists) {
                return $image;
            }
            return $_zp_missing_image;
        }
        $msg = sprintf(gettext('Bad filename suffix in newImage(%s)'), $filename);
    }
    if (!$quiet) {
        zp_error($msg, E_USER_WARNING);
    }
    return $_zp_missing_image;
}
開發者ID:ariep,項目名稱:ZenPhoto20-DEV,代碼行數:56,代碼來源:class-image.php

示例2: printAlbumEditForm


//.........這裏部分代碼省略.........
            if (empty($images)) {
                $t = $newalbum->getAlbumThumbImage();
                if (strtolower(get_class($t)) !== 'transientimage' && $t->exists) {
                    $imagelist[] = '/' . $t->getAlbumName() . '/' . $t->filename;
                }
            }
        }
        if ($thumb && !is_numeric($thumb)) {
            // check for current thumb being in the list. If not, add it
            $target = $thumb;
            $targetA = array('folder' => dirname($thumb), 'filename' => basename($thumb));
            if (!in_array($target, $imagelist) && !in_array($targetA, $imagelist)) {
                array_unshift($imagelist, $target);
            }
        }
        if (!empty($imagelist)) {
            // there are some images to choose from
            foreach ($imagelist as $imagename) {
                if (is_array($imagename)) {
                    $image = newImage($imagename);
                    $imagename = '/' . $imagename['folder'] . '/' . $imagename['filename'];
                    $filename = basename($imagename);
                } else {
                    $albumname = trim(dirname($imagename), '/');
                    if (empty($albumname) || $albumname == '.') {
                        $thumbalbum = $album;
                    } else {
                        $thumbalbum = newAlbum($albumname);
                    }
                    $filename = basename($imagename);
                    $image = newImage($thumbalbum, $filename);
                }
                $selected = $imagename == $thumb;
                if (Gallery::imageObjectClass($filename) == 'Image' || !is_null($image->objectsThumb)) {
                    echo "\n<option";
                    if ($_zp_gallery->getThumbSelectImages()) {
                        echo " class=\"thumboption\"";
                        echo " style=\"background-image: url(" . html_encode(pathurlencode(getAdminThumb($image, 'medium'))) . "); background-repeat: no-repeat;\"";
                    }
                    echo " value=\"" . $imagename . "\"";
                    if ($selected) {
                        echo " selected=\"selected\"";
                    }
                    echo ">" . $image->getTitle();
                    if ($filename != $image->getTitle()) {
                        echo " ({$filename})";
                    }
                    echo "</option>";
                }
            }
        }
        ?>
									</select>
								</td>
							</tr>
							<?php 
    }
    echo $custom = zp_apply_filter('edit_album_custom_data', '', $album, $prefix);
    ?>
					</table>
				</td>
				<?php 
    $bglevels = array('#fff', '#f8f8f8', '#efefef', '#e8e8e8', '#dfdfdf', '#d8d8d8', '#cfcfcf', '#c8c8c8');
    ?>
				<td class="rightcolumn" valign="top">
					<h2 class="h2_bordered_edit"><?php 
開發者ID:ariep,項目名稱:ZenPhoto20-DEV,代碼行數:67,代碼來源:admin-functions.php

示例3: loadFileNames

 /**
  * Load all of the filenames that are found in this Albums directory on disk.
  * Returns an array with all the names.
  *
  * @param  $dirs Whether or not to return directories ONLY with the file array.
  * @return array
  */
 protected function loadFileNames($dirs = false)
 {
     clearstatcache();
     $albumdir = $this->localpath;
     $dir = @opendir($albumdir);
     if (!$dir) {
         if (is_dir($albumdir)) {
             $msg = sprintf(gettext("Error: The album %s is not readable."), html_encode($this->name));
         } else {
             $msg = sprintf(gettext("Error: The album named %s cannot be found."), html_encode($this->name));
         }
         zp_error($msg, E_USER_WARNING);
         return array();
     }
     $files = array();
     $others = array();
     while (false !== ($file = readdir($dir))) {
         $file8 = filesystemToInternal($file);
         if (@$file8[0] != '.') {
             if ($dirs && (is_dir($albumdir . $file) || hasDynamicAlbumSuffix($file))) {
                 $files[] = $file8;
             } else {
                 if (!$dirs && is_file($albumdir . $file)) {
                     if ($handler = Gallery::imageObjectClass($file)) {
                         $files[] = $file8;
                         if ($handler !== 'Image') {
                             $others[] = $file8;
                         }
                     }
                 }
             }
         }
     }
     closedir($dir);
     if (count($others) > 0) {
         $others_thumbs = array();
         foreach ($others as $other) {
             $others_root = substr($other, 0, strrpos($other, "."));
             foreach ($files as $image) {
                 if ($image != $other) {
                     $image_root = substr($image, 0, strrpos($image, "."));
                     if ($image_root == $others_root && Gallery::imageObjectClass($image) == 'Image') {
                         $others_thumbs[] = $image;
                     }
                 }
             }
         }
         $files = array_diff($files, $others_thumbs);
     }
     if ($dirs) {
         return zp_apply_filter('album_filter', $files);
     } else {
         return zp_apply_filter('image_filter', $files);
     }
 }
開發者ID:ariep,項目名稱:ZenPhoto20-DEV,代碼行數:62,代碼來源:class-album.php

示例4: getImageURI

                $uri = getImageURI($args, dirname($i), basename($i), NULL);
                header("HTTP/1.0 302 Found");
                header("Status: 302 Found");
                header('Location: ' . $uri);
                exitZP();
            }
        }
    }
}
if (isset($_GET['fromlogout'])) {
    header("HTTP/1.0 302 Found");
    header("Status: 302 Found");
    header('Location: ' . WEBPATH . '/index.php');
    exitZP();
}
if (empty($image) && Gallery::imageObjectClass($album)) {
    $image = basename($album);
    $album = dirname($album);
}
$_404_data = array($album, $image, $obj = @$_zp_gallery_page, @$_index_theme, @$_zp_page);
$_zp_gallery_page = '404.php';
if (isset($_index_theme)) {
    $_zp_script = SERVERPATH . "/" . THEMEFOLDER . '/' . internalToFilesystem($_index_theme) . '/404.php';
} else {
    $_zp_script = NULL;
}
if (class_exists('ipBlocker')) {
    ipBlocker::notFound();
}
header('Content-Type: text/html; charset=' . LOCAL_CHARSET);
header("HTTP/1.0 404 Not Found");
開發者ID:ariep,項目名稱:ZenPhoto20-DEV,代碼行數:31,代碼來源:404.php

示例5: str_replace

     }
     $album->setShow((int) ($_POST['publishalbum'] == 'true'));
     $album->save();
 } else {
     $AlbumDirName = str_replace(SERVERPATH, '', $_zp_gallery->albumdir);
     zp_error(gettext("The album could not be created in the “albums” folder. This is usually a permissions problem. Try setting the permissions on the “albums” and “cache” folders to be world-writable using a shell:") . " <code>chmod 777 " . $AlbumDirName . '/' . CACHEFOLDER . '/' . "</code>, " . gettext("or use your FTP program to give everyone write permissions to those folders."));
 }
 foreach ($_FILES['files']['error'] as $key => $error) {
     $filecount++;
     if ($error == UPLOAD_ERR_OK) {
         $tmp_name = $_FILES['files']['tmp_name'][$key];
         $name = sanitize_path($_FILES['files']['name'][$key]);
         $soename = seoFriendly($name);
         $error = zp_apply_filter('check_upload_quota', UPLOAD_ERR_OK, $tmp_name);
         if (!$error) {
             if (Gallery::imageObjectClass($name)) {
                 if (strrpos($soename, '.') === 0) {
                     $soename = md5($name) . $soename;
                 }
                 // soe stripped out all the name.
                 if (!$error) {
                     $uploadfile = $targetPath . '/' . internalToFilesystem($soename);
                     if (file_exists($uploadfile)) {
                         $append = '_' . time();
                         $soename = stripSuffix($soename) . $append . '.' . getSuffix($soename);
                         $uploadfile = $targetPath . '/' . internalToFilesystem($soename);
                     }
                     move_uploaded_file($tmp_name, $uploadfile);
                     @chmod($uploadfile, FILE_MOD);
                     $image = newImage($album, $soename);
                     $image->setOwner($_zp_current_admin_obj->getUser());
開發者ID:ariep,項目名稱:ZenPhoto20-DEV,代碼行數:31,代碼來源:uploader.php

示例6: handle_file_upload

 private function handle_file_upload($uploaded_file, $name, $size, $type, $error)
 {
     global $folder, $targetPath, $_zp_current_admin_obj;
     $file = new stdClass();
     $name = $this->trim_file_name($name, $type);
     $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);
     }
     $file->name = $seoname;
     $file->size = intval($size);
     $file->type = $type;
     $error = $this->has_error($uploaded_file, $file, $error);
     if (!$error && $file->name) {
         $file_path = $this->options['upload_dir'] . $file->name;
         $append_file = !$this->options['discard_aborted_uploads'] && is_file($file_path) && $file->size > filesize($file_path);
         clearstatcache();
         if ($uploaded_file && is_uploaded_file($uploaded_file)) {
             // multipart/formdata uploads (POST method uploads)
             if ($append_file) {
                 file_put_contents($file_path, fopen($uploaded_file, 'r'), FILE_APPEND);
             } else {
                 move_uploaded_file($uploaded_file, $file_path);
                 if (Gallery::imageObjectClass($name)) {
                     @chmod($targetFile, FILE_MOD);
                     $album = newAlbum($folder);
                     $image = newImage($album, $seoname);
                     $image->setOwner($_zp_current_admin_obj->getUser());
                     if ($name != $seoname && $image->getTitle() == substr($seoname, 0, strrpos($seoname, '.'))) {
                         $image->setTitle(stripSuffix($name, '.'));
                     }
                     $image->save();
                 } else {
                     if (is_zip($targetFile)) {
                         unzip($targetFile, $targetPath);
                         unlink($targetFile);
                     } else {
                         $file->error = $error = UPLOAD_ERR_EXTENSION;
                         // invalid file uploaded
                     }
                 }
             }
         } else {
             // Non-multipart uploads (PUT method support)
             file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0);
         }
         $file_size = filesize($file_path);
         if ($file_size === $file->size) {
             $file->url = $this->options['upload_url'] . rawurlencode($file->name);
             foreach ($this->options['image_versions'] as $version => $options) {
                 if ($this->create_scaled_image($file->name, $options)) {
                     $file->{$version . '_url'} = $options['upload_url'] . rawurlencode($file->name);
                 }
             }
         } else {
             if ($this->options['discard_aborted_uploads']) {
                 @chmod($file_path, 0777);
                 unlink($file_path);
                 $file->error = 'abort';
             }
         }
         $file->size = $file_size;
         $file->delete_url = $this->options['script_url'] . '?file=' . rawurlencode($file->name);
         $file->delete_type = 'DELETE';
     } else {
         $file->error = $error;
     }
     return $file;
 }
開發者ID:ariep,項目名稱:ZenPhoto20-DEV,代碼行數:76,代碼來源:uploader.php

示例7: rewrite_get_album_image

/**
 * Handles the special cases of album/image[rewrite_suffix]
 *
 * Separates the image part from the album if it is an image reference
 * Strips off the mod_rewrite_suffix if present
 * Handles dynamic album names that do not have the .alb suffix appended
 *
 * @param string $albumvar	$_GET index for "albums"
 * @param string $imagevar	$_GET index for "images"
 */
function rewrite_get_album_image($albumvar, $imagevar)
{
    global $_zp_rewritten, $_zp_albumHandlers;
    $ralbum = isset($_GET[$albumvar]) ? trim(sanitize($_GET[$albumvar]), '/') : NULL;
    $rimage = isset($_GET[$imagevar]) ? sanitize($_GET[$imagevar]) : NULL;
    //	we assume that everything is correct if rewrite rules were not applied
    if ($_zp_rewritten) {
        if (!empty($ralbum) && empty($rimage)) {
            //	rewrite rules never set the image part!
            $path = internalToFilesystem(getAlbumFolder(SERVERPATH) . $ralbum);
            if (IM_SUFFIX) {
                // require the rewrite have the suffix as well
                if (preg_match('|^(.*)' . preg_quote(IM_SUFFIX) . '$|', $ralbum, $matches)) {
                    //has an IM_SUFFIX attached
                    $rimage = basename($matches[1]);
                    $ralbum = trim(dirname($matches[1]), '/');
                    $path = internalToFilesystem(getAlbumFolder(SERVERPATH) . $ralbum);
                }
            } else {
                //	have to figure it out
                if (Gallery::imageObjectClass($ralbum)) {
                    //	it is an image request
                    $rimage = basename($ralbum);
                    $ralbum = trim(dirname($ralbum), '/');
                    $path = internalToFilesystem(getAlbumFolder(SERVERPATH) . $ralbum);
                }
            }
            if (!is_dir($path)) {
                if ($suffix = isHandledAlbum($path)) {
                    //	it is a dynamic album sans suffix
                    $ralbum .= '.' . $suffix;
                }
            }
        }
        if (empty($ralbum)) {
            unset($_GET[$albumvar]);
        } else {
            $_GET[$albumvar] = $ralbum;
        }
        if (empty($rimage)) {
            unset($_GET[$imagevar]);
        } else {
            $_GET[$imagevar] = $rimage;
        }
    }
    return array($ralbum, $rimage);
}
開發者ID:ariep,項目名稱:ZenPhoto20-DEV,代碼行數:57,代碼來源:functions-basic.php


注:本文中的Gallery::imageObjectClass方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。