本文整理汇总了PHP中Image::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Image::__construct方法的具体用法?PHP Image::__construct怎么用?PHP Image::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Image
的用法示例。
在下文中一共展示了Image::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param integer $ID
* @param bool $withWPPost
* load into the Post object all members from \WP_Post
*
* @see https://developer.wordpress.org/reference/classes/wp_post/
*/
public function __construct($ID = 0, $withWPPost = false)
{
parent::__construct($ID);
if ($withWPPost) {
$this->wpPost = \WP_Post::get_instance($this->ID);
}
}
示例2: __construct
/**
* Create a new cached image.
*
*/
public function __construct($source = null, $args = null)
{
parent::__construct(array(), false);
$this->ID = -1;
$this->Filename = CloudAssets::config()->missing_image;
$this->source = $source;
if (empty($args)) {
$this->dimensions = '100x100';
} else {
switch ($args[0]) {
case 'SetWidth':
case 'SetHeight':
$this->dimensions = $args[1] . 'x' . $args[1];
break;
case 'SetSize':
case 'SetRatioSize':
case 'ResizedImage':
case 'CroppedImage':
case 'PaddedImage':
$this->dimensions = $args[1] . 'x' . $args[2];
break;
default:
$this->dimensions = '100x100';
}
}
}
示例3: imagecreatetruecolor
function __construct($image, $width, $height)
{
parent::__construct($image);
$thumb = imagecreatetruecolor($width, $height);
imagecopyresampled($thumb, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height);
$this->image = $thumb;
}
示例4: __construct
public function __construct($aWidth, $aHeight, $a = 0, $aFormat = DEFAULT_GFORMAT, $aSetAutoMargin = true)
{
parent::__construct($aWidth, $aHeight, $aFormat, $aSetAutoMargin);
$this->dx = $this->left_margin + $this->plotwidth / 2;
$this->dy = $this->top_margin + $this->plotheight / 2;
$this->SetAngle($a);
}
示例5: __construct
/**
* Constructor
*
* @param integer $ID
* @param bool $withWPUser load into the User object all members from \WP_User
*
* @see https://developer.wordpress.org/reference/classes/wp_user/
*/
public function __construct($ID = 0, $withWPUser = true)
{
parent::__construct($ID);
if ($withWPUser) {
$this->wpUser = new \WP_User($this->ID);
}
}
示例6: __construct
public function __construct($file)
{
if (!Image_GD::$_checked) {
// Run the install check
Image_GD::check();
}
parent::__construct($file);
// Set the image creation function name
switch ($this->type) {
case IMAGETYPE_JPEG:
$create = 'imagecreatefromjpeg';
break;
case IMAGETYPE_GIF:
$create = 'imagecreatefromgif';
break;
case IMAGETYPE_PNG:
$create = 'imagecreatefrompng';
break;
}
if (!isset($create) or !function_exists($create)) {
throw new Kohana_Exception('Installed GD does not support :type images', array(':type' => image_type_to_extension($this->type, FALSE)));
}
// Save function for future use
$this->_create_function = $create;
// Save filename for lazy loading
$this->_image = $this->file;
}
示例7: __construct
public function __construct($file)
{
if (!Image_GD::$_checked) {
// Run the install check
Image_GD::check();
}
parent::__construct($file);
// Set the image creation function name
switch ($this->type) {
case IMAGETYPE_JPEG:
$create = 'imagecreatefromjpeg';
break;
case IMAGETYPE_GIF:
$create = 'imagecreatefromgif';
break;
case IMAGETYPE_PNG:
$create = 'imagecreatefrompng';
break;
}
if (!isset($create) or !function_exists($create)) {
throw new Kohana_Exception('Installed GD does not support :type images', array(':type' => image_type_to_extension($this->type, FALSE)));
}
// Open the temporary image
$this->_image = $create($this->file);
// Preserve transparency when saving
imagesavealpha($this->_image, TRUE);
}
示例8: __construct
/**
* Runs [Image_ImageMagick::check] and loads the image.
*
* @return void
* @throws Kohana_Exception
*/
public function __construct($file)
{
// Load ImageMagick path from config
Image_ImageMagick::$_imagemagick = Kohana::$config->load('imagemagick')->path;
if (!is_dir(Image_ImageMagick::$_imagemagick)) {
throw new Kohana_Exception('ImageMagick path is not a valid directory, check your configuration');
}
parent::__construct($file);
}
示例9: __construct
/**
* {@inheritdoc}
*
* @param string $file Filepath of the watermark to be loaded.
* @param array $options Array of options to be set, with keys: size,
* position and/or margin.
*/
public function __construct($file = null, $options = [])
{
if (!empty($options)) {
foreach ($options as $option => $values) {
$method = 'set' . ucfirst($option);
if (!method_exists($this, $method)) {
continue;
}
$this->{$method}($values);
}
}
return parent::__construct($file);
}
示例10: __construct
/**
* Runs [Image_Imagick::check] and loads the image.
*
* @return void
* @throws Gleez_Exception
*/
public function __construct($file)
{
if (!Image_Imagick::$_checked) {
// Run the install check
Image_Imagick::check();
}
parent::__construct($file);
$this->im = new Imagick();
$this->im->readImage($file);
if (!$this->im->getImageAlphaChannel()) {
// Force the image to have an alpha channel
$this->im->setImageAlphaChannel(Imagick::ALPHACHANNEL_SET);
}
}
示例11: __construct
public function __construct($source = '', $title = '', $onRight = true)
{
parent::__construct($source, $title);
$source = Url::completeUrl($source);
try {
$description = getimagesize($source);
if ($description[0] < $description[1]) {
if ($onRight) {
$this->makeRightFloating();
} else {
$this->makeLeftFloating();
}
}
} catch (Exception $e) {
// let as is, because we do not know
}
}
示例12: register
function register($imageloc, $data)
{
/*
Register nama urlnya jadi:
/assets/virt/[link]/[size].[source].[type]
*/
$alamat = pathinfo($imageloc);
$link = uniqid("", true);
$srcx = hash_file("sha256", $imageloc, false);
$fname = $srcx . '.' . $alamat['extension'];
rename($alamat, __DIR__ . '/../..' . '/gamvar/' . $fname);
parent::__construct($fname, false, __DIR__ . '/../..' . '/gamvar/');
$w = parent::$width;
$h = parent::$height;
$datatab = array("size" => $w . "x" . $h, "aksesable" => 1, "date_added" => date("Y-m-d H:i:s"), "source" => $fname, "link" => $link, 'srcx' => $srcx);
$this->db->copyfrom(array_merge($data, $datatab), function ($val) {
return array_intersect_key($val, array_flip(array('uid', 'link', 'source', 'aksesable', 'size', 'date_added', 'srcx')));
})->insert();
}
示例13: __construct
public function __construct($filename)
{
if (!file_exists($filename)) {
throw new Exception('File does not exist: ' . $filename);
}
if (!is_file($filename)) {
throw new Exception('Filename is not a file: ' . $filename);
}
if (!is_readable($filename)) {
throw new Exception('File is not readable: ' . $filename);
}
$contents = file_get_contents($filename);
if ($contents === FALSE) {
throw new Exception('Could not read file: ' . $filename);
}
$this->_filename = $filename;
parent::__construct();
$this->setContents($contents);
}
示例14: __construct
/**
* Brick constructor.
* @param $path (Путь к файлу(-ам))
*/
public function __construct($path)
{
parent::__construct($path);
}
示例15: __construct
/**
* @param array|null $record
* @param boolean $isSingleton
* @param DataModel|null $model
*/
public function __construct($record = null, $isSingleton = false, $model = null)
{
parent::__construct($record, $isSingleton, $model);
$this->setCompressor(new Compressor($this->config()->tinypng_api_key));
}