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


PHP Gallery::get_resize_properties方法代碼示例

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


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

示例1: synchronize

 /**
  * {@inheritdoc}
  */
 public function synchronize()
 {
     $this->pictures = array();
     $config = GalleryConfig::load();
     $Gallery = new Gallery();
     $result = PersistenceContext::get_querier()->select("SELECT g.id, g.name, g.path, g.width, g.height, g.idcat, gc.auth\n\t\tFROM " . GallerySetup::$gallery_table . " g\n\t\tLEFT JOIN " . GallerySetup::$gallery_cats_table . " gc on gc.id = g.idcat\n\t\tWHERE g.aprob = 1\n\t\tORDER BY RAND()\n\t\tLIMIT 30");
     while ($row = $result->fetch()) {
         $row['auth'] = $row['idcat'] == 0 ? $config->get_authorizations() : unserialize(stripslashes($row['auth']));
         //Calcul des dimensions avec respect des proportions.
         list($row['width'], $row['height']) = $Gallery->get_resize_properties($row['width'], $row['height']);
         $this->pictures[$row['id']] = $row;
     }
     $result->dispose();
 }
開發者ID:AroundPBT,項目名稱:PHPBoost,代碼行數:17,代碼來源:GalleryMiniMenuCache.class.php

示例2: unserialize

 function get_cache()
 {
     global $Sql;
     global $CONFIG_GALLERY;
     $gallery_config = 'global $CONFIG_GALLERY;' . "\n";
     $CONFIG_GALLERY = unserialize($Sql->query("SELECT value FROM " . DB_TABLE_CONFIGS . " WHERE name = 'gallery'", __LINE__, __FILE__));
     $CONFIG_GALLERY = is_array($CONFIG_GALLERY) ? $CONFIG_GALLERY : array();
     if (isset($CONFIG_GALLERY['auth_root'])) {
         $CONFIG_GALLERY['auth_root'] = unserialize($CONFIG_GALLERY['auth_root']);
     }
     $gallery_config .= '$CONFIG_GALLERY = ' . var_export($CONFIG_GALLERY, true) . ';' . "\n";
     $cat_gallery = 'global $CAT_GALLERY;' . "\n";
     $result = $Sql->query_while("SELECT id, id_left, id_right, level, name, aprob, auth\n\t\tFROM " . PREFIX . "gallery_cats\n\t\tORDER BY id_left", __LINE__, __FILE__);
     while ($row = $Sql->fetch_assoc($result)) {
         if (empty($row['auth'])) {
             $row['auth'] = serialize(array());
         }
         $cat_gallery .= '$CAT_GALLERY[\'' . $row['id'] . '\'][\'id_left\'] = ' . var_export($row['id_left'], true) . ';' . "\n";
         $cat_gallery .= '$CAT_GALLERY[\'' . $row['id'] . '\'][\'id_right\'] = ' . var_export($row['id_right'], true) . ';' . "\n";
         $cat_gallery .= '$CAT_GALLERY[\'' . $row['id'] . '\'][\'level\'] = ' . var_export($row['level'], true) . ';' . "\n";
         $cat_gallery .= '$CAT_GALLERY[\'' . $row['id'] . '\'][\'name\'] = ' . var_export($row['name'], true) . ';' . "\n";
         $cat_gallery .= '$CAT_GALLERY[\'' . $row['id'] . '\'][\'aprob\'] = ' . var_export($row['aprob'], true) . ';' . "\n";
         $cat_gallery .= '$CAT_GALLERY[\'' . $row['id'] . '\'][\'auth\'] = ' . var_export(unserialize($row['auth']), true) . ';' . "\n";
     }
     $Sql->query_close($result);
     include_once PATH_TO_ROOT . '/gallery/gallery.class.php';
     $Gallery = new Gallery();
     $_array_random_pics = 'global $_array_random_pics;' . "\n" . '$_array_random_pics = array(';
     $result = $Sql->query_while("SELECT g.id, g.name, g.path, g.width, g.height, g.idcat, gc.auth \n\t\tFROM " . PREFIX . "gallery g\n\t\tLEFT JOIN " . PREFIX . "gallery_cats gc on gc.id = g.idcat\n\t\tWHERE g.aprob = 1 AND (gc.aprob = 1 OR g.idcat = 0)\n\t\tORDER BY RAND()\n\t\t" . $Sql->limit(0, 30), __LINE__, __FILE__);
     while ($row = $Sql->fetch_assoc($result)) {
         if ($row['idcat'] == 0) {
             $row['auth'] = serialize($CONFIG_GALLERY['auth_root']);
         }
         list($width, $height) = $Gallery->get_resize_properties($row['width'], $row['height']);
         $_array_random_pics .= 'array(' . "\n" . '\'id\' => ' . var_export($row['id'], true) . ',' . "\n" . '\'name\' => ' . var_export($row['name'], true) . ',' . "\n" . '\'path\' => ' . var_export($row['path'], true) . ',' . "\n" . '\'width\' => ' . var_export($width, true) . ',' . "\n" . '\'height\' => ' . var_export($height, true) . ',' . "\n" . '\'idcat\' => ' . var_export($row['idcat'], true) . ',' . "\n" . '\'auth\' => ' . var_export(unserialize($row['auth']), true) . '),' . "\n";
     }
     $Sql->query_close($result);
     $_array_random_pics .= ');';
     return $gallery_config . "\n" . $cat_gallery . "\n" . $_array_random_pics;
 }
開發者ID:janus57,項目名稱:PHPBoost_v3c,代碼行數:40,代碼來源:gallery_interface.class.php


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