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


PHP Image::__construct方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:chemaclass,项目名称:knob-base,代码行数:16,代码来源:Post.php

示例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';
         }
     }
 }
开发者ID:helpfulrobot,项目名称:markguinn-silverstripe-cloudassets,代码行数:30,代码来源:CloudImageMissing.php

示例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;
 }
开发者ID:469306621,项目名称:Languages,代码行数:7,代码来源:Image.class.php

示例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);
 }
开发者ID:amenadiel,项目名称:jpgraph,代码行数:7,代码来源:RotImage.php

示例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);
     }
 }
开发者ID:chemaclass,项目名称:knob-base,代码行数:15,代码来源:User.php

示例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;
 }
开发者ID:homm,项目名称:image,代码行数:27,代码来源:gd.php

示例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);
 }
开发者ID:joelpittet,项目名称:image,代码行数:27,代码来源:gd.php

示例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);
 }
开发者ID:2bj,项目名称:kohana-imagemagick-driver,代码行数:15,代码来源:imagemagick.php

示例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);
 }
开发者ID:elboletaire,项目名称:watimage,代码行数:20,代码来源:Watermark.php

示例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);
     }
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:20,代码来源:imagick.php

示例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
     }
 }
开发者ID:KasaiDot,项目名称:Zero-Fansub-website,代码行数:17,代码来源:AutoFloatImage.php

示例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();
 }
开发者ID:Kekesed,项目名称:Kambeng-Blog,代码行数:19,代码来源:Imager.php

示例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);
 }
开发者ID:uomcs,项目名称:php-png,代码行数:19,代码来源:ImageFile.php

示例14: __construct

 /**
  * Brick constructor.
  * @param $path (Путь к файлу(-ам))
  */
 public function __construct($path)
 {
     parent::__construct($path);
 }
开发者ID:hungry-devel,项目名称:pixelArt,代码行数:8,代码来源:Brick.class.php

示例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));
 }
开发者ID:helpfulrobot,项目名称:kinglozzer-silverstripe-tinypng,代码行数:10,代码来源:Image.php


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