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


PHP IO::get_gallery方法代碼示例

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


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

示例1: gallery

 /**
  * Fetches gallery info for the specified gallery and immediate children.
  */
 function get_gallery($gallery_name, $getChildGalleries = 1)
 {
     $gal = new gallery($gallery_name);
     //if fail then try to open generic metadata
     $fp = @fopen($this->config->base_path . $this->config->pathto_galleries . $gallery_name . "/metadata.csv", "r");
     if ($fp) {
         while ($temp[] = fgetcsv($fp, 2048)) {
         }
         fclose($fp);
         list($gal->filename, $gal->name, $gal->desc, $gal->long_desc, $gal->date) = $temp[1];
         for ($i = 0; $i < count($temp) - 3; $i++) {
             $gal->images[$i] = new image();
             list($gal->images[$i]->filename, $gal->images[$i]->name, $gal->images[$i]->desc, $gal->images[$i]->long_desc, $gal->images[$i]->date, $gal->images[$i]->sort) = $temp[$i + 2];
             $gal->images[$i]->full_path = $gal->name . "/" . $gal->images[$i]->filename;
             //get image size and type
             list($gal->images[$i]->width, $gal->images[$i]->height, $gal->images[$i]->type) = substr($gal->images[$i]->filename, 0, 7) == "http://" ? @GetImageSize($gal->images[$i]->filename) : @GetImageSize($this->config->base_path . $this->config->pathto_galleries . $gal->id . "/" . $gal->images[$i]->filename);
         }
         //discover child galleries
         $dir = photostack::get_listing($this->config->base_path . $this->config->pathto_galleries . $gallery_name . "/", "dirs");
         if ($getChildGalleries) {
             //but only fetch their info if required too
             foreach ($dir->dirs as $gallery) {
                 $gal->galleries[] = $this->get_gallery($gallery_name . "/" . $gallery, $getChildGalleries);
             }
         } else {
             //otherwise just copy their names in so they can be counted
             $gal->galleries = $dir->dirs;
         }
         return $gal;
     } else {
         return parent::get_gallery($gallery_name, $getChildGalleries);
     }
 }
開發者ID:noeljackson,項目名稱:PhotoStack,代碼行數:36,代碼來源:io_csv.class.php

示例2: getGallery

 function getGallery($galleryId, $getChildGalleries = 1)
 {
     $gal =& new gallery($galleryId, $parent);
     //try to open language specific gallery info
     $res = $this->query("SELECT * FROM " . $this->config->sql_prefix . "galleries " . "WHERE galleryid='" . $this->escape_string($galleryId) . "' " . "AND lang='" . $this->escape_string($language) . "'");
     //if fail then try to open generic gallery info
     if (!$res || !$this->num_rows($res)) {
         $res = $this->query("SELECT * FROM " . $this->config->sql_prefix . "galleries " . "WHERE galleryid='" . $this->escape_string($galleryId) . "' and lang=''");
     }
     //if that succeeds then get galleries from db
     if ($res && $this->num_rows($res)) {
         $galinfo = $this->fetch_array($res);
         $gal->filename = $galinfo['filename'];
         $gal->name = $galinfo['name'];
         $gal->desc = $galinfo['description'];
         $gal->date = $galinfo['date'];
         //try to open language specific image info
         $res = $this->query("SELECT * FROM " . $this->config->sql_prefix . "images " . "WHERE galleryid='" . $this->escape_string($galleryId) . "' ");
         //if fail then try to open generic image info
         if (!$res || !$this->num_rows($res)) {
             $res = $this->query("SELECT * FROM " . $this->config->sql_prefix . "images " . "WHERE galleryid='" . $this->escape_string($galleryId) . "'");
         }
         for ($i = 0; $i < $this->num_rows($res); $i++) {
             $imginfo = $this->fetch_array($res);
             $gal->images[$i] =& new image($imginfo['filename'], $gal);
             $gal->images[$i]->thumbnail = $imginfo['thumbnail'];
             $gal->images[$i]->name = $imginfo['name'];
             $gal->images[$i]->desc = $imginfo['description'];
             $gal->images[$i]->date = $imginfo['date'];
         }
     } else {
         //no record found so use iifn method implemented in parent class
         return parent::get_gallery($galleryId, $parent, $getChildGalleries, $language);
     }
     //discover child galleries
     $dir = photostack::get_listing($this->config->base_path . $this->config->pathto_galleries . $galleryId . "/");
     if ($getChildGalleries) {
         //but only fetch their info if required too
         foreach ($dir->dirs as $gallery) {
             $gal->galleries[] =& $this->get_gallery($galleryId . "/" . $gallery, $gal, $getChildGalleries - 1, $language);
         }
     } else {
         //otherwise just copy their names in so they can be counted
         $gal->galleries = $dir->dirs;
     }
     return $gal;
 }
開發者ID:noeljackson,項目名稱:PhotoStack,代碼行數:47,代碼來源:io_sql.class.php


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