当前位置: 首页>>代码示例>>PHP>>正文


PHP image::getDriver方法代码示例

本文整理汇总了PHP中image::getDriver方法的典型用法代码示例。如果您正苦于以下问题:PHP image::getDriver方法的具体用法?PHP image::getDriver怎么用?PHP image::getDriver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在image的用法示例。


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

示例1: checkFile

 public function checkFile($file, array $config)
 {
     $driver = isset($config['imageDriversPriority']) ? image::getDriver(explode(" ", $config['imageDriversPriority'])) : "gd";
     $img = image::factory($driver, $file);
     if ($img->initError) {
         return "Unknown image format/encoding.";
     }
     return true;
 }
开发者ID:CapsuleCorpIndonesia,项目名称:elang-combo,代码行数:9,代码来源:type_img.php

示例2: __construct

 public function __construct()
 {
     // SET CMS INTEGRATION PROPERTY
     if (isset($_GET['cms']) && $this->checkFilename($_GET['cms']) && is_file("integration/{$_GET['cms']}.php")) {
         $this->cms = $_GET['cms'];
     }
     // LINKING UPLOADED FILE
     if (count($_FILES)) {
         $this->file =& $_FILES[key($_FILES)];
     }
     // LOAD DEFAULT CONFIGURATION
     require "conf/config.php";
     // SETTING UP SESSION
     if (!session_id()) {
         if (isset($_CONFIG['_sessionLifetime'])) {
             ini_set('session.gc_maxlifetime', $_CONFIG['_sessionLifetime'] * 60);
         }
         if (isset($_CONFIG['_sessionDir'])) {
             ini_set('session.save_path', $_CONFIG['_sessionDir']);
         }
         if (isset($_CONFIG['_sessionDomain'])) {
             ini_set('session.cookie_domain', $_CONFIG['_sessionDomain']);
         }
         session_start();
     }
     // LOAD SESSION CONFIGURATION IF EXISTS
     $this->config = $_CONFIG;
     $sessVar = "_sessionVar";
     if (isset($_CONFIG[$sessVar])) {
         $sessVar = $_CONFIG[$sessVar];
         if (!isset($_SESSION[$sessVar])) {
             $_SESSION[$sessVar] = array();
         }
         $sessVar =& $_SESSION[$sessVar];
         if (!is_array($sessVar)) {
             $sessVar = array();
         }
         foreach ($sessVar as $key => $val) {
             if (substr($key, 0, 1) != "_" && isset($_CONFIG[$key])) {
                 $this->config[$key] = $val;
             }
         }
         if (!isset($sessVar['self'])) {
             $sessVar['self'] = array();
         }
         $this->session =& $sessVar['self'];
     } else {
         $this->session =& $_SESSION;
     }
     // SECURING THE SESSION
     $stamp = array('ip' => $_SERVER['REMOTE_ADDR'], 'agent' => md5($_SERVER['HTTP_USER_AGENT']));
     if (!isset($this->session['stamp'])) {
         $this->session['stamp'] = $stamp;
     } elseif (!is_array($this->session['stamp']) || $this->session['stamp'] !== $stamp) {
         if ($this->session['stamp']['ip'] === $stamp['ip']) {
             session_destroy();
         }
         die;
     }
     // IMAGE DRIVER INIT
     if (isset($this->config['imageDriversPriority'])) {
         $this->config['imageDriversPriority'] = text::clearWhitespaces($this->config['imageDriversPriority']);
         $driver = image::getDriver(explode(' ', $this->config['imageDriversPriority']));
         if ($driver !== false) {
             $this->imageDriver = $driver;
         }
     }
     if ((!isset($driver) || $driver === false) && image::getDriver(array($this->imageDriver)) === false) {
         die("Cannot find any of the supported PHP image extensions!");
     }
     // WATERMARK INIT
     if (isset($this->config['watermark']) && is_string($this->config['watermark'])) {
         $this->config['watermark'] = array('file' => $this->config['watermark']);
     }
     // GET TYPE DIRECTORY
     $this->types =& $this->config['types'];
     $firstType = array_keys($this->types);
     $firstType = $firstType[0];
     $this->type = isset($_GET['type']) && isset($this->types[$_GET['type']]) ? $_GET['type'] : $firstType;
     // LOAD TYPE DIRECTORY SPECIFIC CONFIGURATION IF EXISTS
     if (is_array($this->types[$this->type])) {
         foreach ($this->types[$this->type] as $key => $val) {
             if (in_array($key, $this->typeSettings)) {
                 $this->config[$key] = $val;
             }
         }
         $this->types[$this->type] = isset($this->types[$this->type]['type']) ? $this->types[$this->type]['type'] : "";
     }
     // COOKIES INIT
     $ip = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
     $ip = '/^' . implode('\\.', array($ip, $ip, $ip, $ip)) . '$/';
     if (preg_match($ip, $_SERVER['HTTP_HOST']) || preg_match('/^[^\\.]+$/', $_SERVER['HTTP_HOST'])) {
         $this->config['cookieDomain'] = "";
     } elseif (!strlen($this->config['cookieDomain'])) {
         $this->config['cookieDomain'] = $_SERVER['HTTP_HOST'];
     }
     if (!strlen($this->config['cookiePath'])) {
         $this->config['cookiePath'] = "/";
     }
     // UPLOAD FOLDER INIT
//.........这里部分代码省略.........
开发者ID:mikegrahamjones,项目名称:kcfinder,代码行数:101,代码来源:uploader.php

示例3: __construct

 public function __construct()
 {
     // DISABLE MAGIC QUOTES
     if (function_exists('set_magic_quotes_runtime')) {
         @set_magic_quotes_runtime(false);
     }
     // INPUT INIT
     $input = new input();
     $this->get =& $input->get;
     $this->post =& $input->post;
     $this->cookie =& $input->cookie;
     // SET CMS INTEGRATION ATTRIBUTE
     if (isset($this->get['cms']) && in_array($this->get['cms'], array("drupal"))) {
         $this->cms = $this->get['cms'];
     }
     // LINKING UPLOADED FILE
     if (count($_FILES)) {
         $this->file =& $_FILES[key($_FILES)];
     }
     // LOAD DEFAULT CONFIGURATION
     require "config.php";
     // SETTING UP SESSION
     if (isset($_CONFIG['_sessionLifetime'])) {
         ini_set('session.gc_maxlifetime', $_CONFIG['_sessionLifetime'] * 60);
     }
     if (isset($_CONFIG['_sessionDir'])) {
         ini_set('session.save_path', $_CONFIG['_sessionDir']);
     }
     if (isset($_CONFIG['_sessionDomain'])) {
         ini_set('session.cookie_domain', $_CONFIG['_sessionDomain']);
     }
     switch ($this->cms) {
         case "drupal":
             break;
         default:
             session_start();
             break;
     }
     // RELOAD DEFAULT CONFIGURATION
     require "config.php";
     $this->config = $_CONFIG;
     // LOAD SESSION CONFIGURATION IF EXISTS
     if (isset($_CONFIG['_sessionVar']) && is_array($_CONFIG['_sessionVar'])) {
         foreach ($_CONFIG['_sessionVar'] as $key => $val) {
             if (substr($key, 0, 1) != "_" && isset($_CONFIG[$key])) {
                 $this->config[$key] = $val;
             }
         }
         if (!isset($this->config['_sessionVar']['self'])) {
             $this->config['_sessionVar']['self'] = array();
         }
         $this->session =& $this->config['_sessionVar']['self'];
     } else {
         $this->session =& $_SESSION;
     }
     // SET DYNAMIC UPLOAD URL
     if (!empty($_GET['uploadUrl'])) {
         $_CONFIG['uploadURL'] .= str_replace("..", "", str_replace("../", "", $_GET['uploadUrl']));
         $this->config['uploadURL'] = $_CONFIG['uploadURL'];
     } else {
         if (!empty($_SESSION['kcFinder_uploadUrl'])) {
             $_CONFIG['uploadURL'] .= str_replace("..", "", str_replace("../", "", $_SESSION['kcFinder_uploadUrl']));
             $this->config['uploadURL'] = $_CONFIG['uploadURL'];
         }
     }
     // IMAGE DRIVER INIT
     if (isset($this->config['imageDriversPriority'])) {
         $this->config['imageDriversPriority'] = text::clearWhitespaces($this->config['imageDriversPriority']);
         $driver = image::getDriver(explode(' ', $this->config['imageDriversPriority']));
         if ($driver !== false) {
             $this->imageDriver = $driver;
         }
     }
     if ((!isset($driver) || $driver === false) && image::getDriver(array($this->imageDriver)) === false) {
         die("Cannot find any of the supported PHP image extensions!");
     }
     // WATERMARK INIT
     if (isset($this->config['watermark']) && is_string($this->config['watermark'])) {
         $this->config['watermark'] = array('file' => $this->config['watermark']);
     }
     // GET TYPE DIRECTORY
     $this->types =& $this->config['types'];
     $firstType = array_keys($this->types);
     $firstType = $firstType[0];
     $this->type = isset($this->get['type']) && isset($this->types[$this->get['type']]) ? $this->get['type'] : $firstType;
     // LOAD TYPE DIRECTORY SPECIFIC CONFIGURATION IF EXISTS
     if (is_array($this->types[$this->type])) {
         foreach ($this->types[$this->type] as $key => $val) {
             if (in_array($key, $this->typeSettings)) {
                 $this->config[$key] = $val;
             }
         }
         $this->types[$this->type] = isset($this->types[$this->type]['type']) ? $this->types[$this->type]['type'] : "";
     }
     // COOKIES INIT
     $ip = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
     $ip = '/^' . implode('\\.', array($ip, $ip, $ip, $ip)) . '$/';
     if (preg_match($ip, $_SERVER['HTTP_HOST']) || preg_match('/^[^\\.]+$/', $_SERVER['HTTP_HOST'])) {
         $this->config['cookieDomain'] = "";
     } elseif (!strlen($this->config['cookieDomain'])) {
//.........这里部分代码省略.........
开发者ID:skullyframework,项目名称:skully-amazon-s3,代码行数:101,代码来源:uploader.php


注:本文中的image::getDriver方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。