当前位置: 首页>>代码示例>>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;未经允许,请勿转载。