本文整理汇总了PHP中WideImage::path方法的典型用法代码示例。如果您正苦于以下问题:PHP WideImage::path方法的具体用法?PHP WideImage::path怎么用?PHP WideImage::path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WideImage
的用法示例。
在下文中一共展示了WideImage::path方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: path
/**
* Returns the path to the library
*
* @return string
*/
static function path()
{
if (self::$path === null) {
self::$path = dirname(__FILE__) . DIRECTORY_SEPARATOR;
}
return self::$path;
}
示例2: get
static function get($operationName)
{
if (!isset(self::$cache[$operationName])) {
$opClassName = "WideImage_Operation_" . $operationName;
if (!class_exists($opClassName, false)) {
$fileName = WideImage::path() . 'Operation/' . $operationName . '.php';
if (file_exists($fileName)) {
require_once $fileName;
} else {
throw new WideImage_UnknownImageOperationException("Can't load '{$operationName}' operation.");
}
}
self::$cache[$operationName] = new $opClassName();
}
return self::$cache[$operationName];
}
示例3: get
public static function get($operationName)
{
$lcname = strtolower($operationName);
if (!isset(self::$cache[$lcname])) {
$opClassName = 'WideImage_Operation_' . ucfirst($operationName);
if (!class_exists($opClassName, false)) {
$fileName = WideImage::path() . 'Operation/' . ucfirst($operationName) . '.php';
if (file_exists($fileName)) {
require_once $fileName;
} elseif (!class_exists($opClassName)) {
throw new WideImage_UnknownImageOperationException("Can't load '{$operationName}' operation.");
}
}
self::$cache[$lcname] = new $opClassName();
}
return self::$cache[$lcname];
}
示例4: selectMapper
/**
* Returns a mapper, based on the $uri and $format
*
* @param string $uri File URI
* @param string $format File format (extension or mime-type) or null
* @return WideImage_Mapper
**/
static function selectMapper($uri, $format = null)
{
$format = self::determineFormat($uri, $format);
if (array_key_exists($format, self::$mappers)) {
return self::$mappers[$format];
}
$mapperClassName = 'WideImage_Mapper_' . $format;
if (!class_exists($mapperClassName, false)) {
$mapperFileName = WideImage::path() . 'Mapper/' . $format . '.php';
if (file_exists($mapperFileName)) {
require_once $mapperFileName;
}
}
if (class_exists($mapperClassName)) {
self::$mappers[$format] = new $mapperClassName();
return self::$mappers[$format];
}
throw new WideImage_UnsupportedFormatException("Format '{$format}' is not supported.");
}
示例5: load
<?php
/**
* @author Gasper Kozak
* @copyright 2007-2011
**/
include_once WideImage::path() . '/vendor/de77/TGA.php';
/**
* Mapper support for TGA.
*/
class WideImage_Mapper_TGA
{
public function load($uri)
{
return WideImage_vendor_de77_TGA::imagecreatefromtga($uri);
}
public function loadFromString($data)
{
return WideImage_vendor_de77_TGA::imagecreatefromstring($data);
}
public function save($handle, $uri = null)
{
throw new WideImage_Exception("Saving to TGA isn't supported.");
}
}
示例6: setup
<?php
/**
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
**/
include WideImage::path() . 'Mapper/GD.php';
class WideImage_Mapper_GD_Test extends WideImage_TestCase
{
/**
* @var WideImage_Mapper_GD
*/
protected $mapper;
public function setup()
{
$this->mapper = WideImage_MapperFactory::selectMapper(null, 'gd');
}
public function teardown()
{
$this->mapper = null;
if (file_exists(IMG_PATH . 'temp/test.gd')) {
unlink(IMG_PATH . 'temp/test.gd');
}
}
public function testSaveAndLoad()
{
$handle = imagecreatefromgif(IMG_PATH . '100x100-color-hole.gif');
$this->mapper->save($handle, IMG_PATH . 'temp/test.gd');
$this->assertTrue(filesize(IMG_PATH . 'temp/test.gd') > 0);
imagedestroy($handle);
// file is a valid image
示例7: setup
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
WideImage is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with WideImage; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* @package Tests
**/
include WideImage::path() . 'Mapper/PNG.php';
/**
* @package Tests
*/
class WideImage_Mapper_PNG_Test extends WideImage_TestCase
{
protected $mapper;
function setup()
{
$this->mapper = WideImage_MapperFactory::selectMapper(null, 'png');
}
function teardown()
{
$this->mapper = null;
if (file_exists(IMG_PATH . 'temp/test.png')) {
unlink(IMG_PATH . 'temp/test.png');
示例8: load
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
WideImage is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with WideImage; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* @package Internal/Mappers
**/
include_once WideImage::path() . '/vendor/JPEXS/bmp.php';
/**
* Mapper support for BMP
*
* Code used with permission from JPEXS
* http://www.jpexs.com/php.html
*
* @package Internal/Mappers
*/
class WideImage_Mapper_BMP
{
function load($uri)
{
return imagecreatefrombmp($uri);
}
function save($handle, $uri = null)
示例9: setup
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
WideImage is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with WideImage; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* @package Tests
**/
include WideImage::path() . 'Mapper/BMP.php';
/**
* @package Tests
*/
class WideImage_Mapper_BMP_Test extends WideImage_TestCase
{
/**
* @var WideImage_Mapper_BMP
*/
protected $mapper;
function setup()
{
$this->mapper = WideImage_MapperFactory::selectMapper(null, 'bmp');
}
function teardown()
{
示例10: setup
<?php
/**
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
**/
include WideImage::path() . 'Mapper/TGA.php';
/**
* @group mapper
*/
class WideImage_Mapper_TGA_Test extends WideImage_TestCase
{
/**
* @var WideImage_Mapper_TGA
*/
protected $mapper;
public function setup()
{
$this->mapper = WideImage_MapperFactory::selectMapper(null, 'tga');
}
public function teardown()
{
$this->mapper = null;
}
public function testLoad()
{
$handle = $this->mapper->load(IMG_PATH . 'splat.tga');
$this->assertTrue(is_resource($handle));
$this->assertEquals(100, imagesx($handle));
$this->assertEquals(100, imagesy($handle));
imagedestroy($handle);