__construct() public method

public __construct ( $file )
Example #1
0
 /**
  * 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);
     }
 }
 /**
  * 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';
         }
     }
 }
Example #3
0
 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;
 }
Example #4
0
 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);
 }
Example #5
0
 /**
  * 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);
     }
 }
Example #6
0
File: gd.php Project: homm/image
 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;
 }
Example #7
0
 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);
 }
 /**
  * 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);
 }
Example #9
0
 /**
  * {@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);
 }
Example #10
0
 /**
  * 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);
     }
 }
 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
     }
 }
Example #12
0
 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();
 }
Example #13
0
 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);
 }
Example #14
0
 /**
  * Brick constructor.
  * @param $path (Путь к файлу(-ам))
  */
 public function __construct($path)
 {
     parent::__construct($path);
 }
 /**
  * @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));
 }
Example #16
0
 /**
  * Create a new cached image.
  * @param string $filename The filename of the image.
  * @param boolean $isSingleton This this to true if this is a singleton() object, a stub for calling methods.
  *                             Singletons don't have their defaults set.
  */
 public function __construct($filename = null, $isSingleton = false)
 {
     parent::__construct(array(), $isSingleton);
     $this->ID = -1;
     $this->Filename = $filename;
 }
Example #17
0
 /**
  * Create a new cached image.
  * @param string $filename The filename of the image.
  * @param boolean $isSingleton This this to true if this is a singleton() object, a stub for calling methods.
  *                             Singletons don't have their defaults set.
  */
 public function __construct($filename = null, $isSingleton = false, Image $sourceImage = null)
 {
     parent::__construct(array(), $isSingleton);
     if ($sourceImage) {
         // Copy properties from source image, except unsafe ones
         $properties = $sourceImage->toMap();
         unset($properties['RecordClassName'], $properties['ClassName']);
         $this->update($properties);
     }
     $this->ID = -1;
     $this->Filename = $filename;
 }
 /**
  * @param string $filePath
  *
  * @inheritdoc
  */
 public function __construct($filePath, $config = [])
 {
     $this->filePath = $filePath;
     parent::__construct($config);
 }
 function Image($image, $isfile = false)
 {
     Image::__construct($image, $isfile);
 }
Example #20
0
 /**
  * Implements __construct().
  *
  * @param string $url
  *   Image URL.
  * @param mixed $identifier
  *   Identifier.
  */
 public function __construct($url, $identifier = NULL)
 {
     parent::__construct('logo', $url, $identifier);
 }
Example #21
0
 /**
  * Create a new cached image.
  * @param string $filename The filename of the image.
  * @param boolean $isSingleton This this to true if this is a singleton() object, a stub for calling methods.
  *                             Singletons don't have their defaults set.
  */
 public function __construct($filename = null, $isSingleton = false, Image $sourceImage = null)
 {
     parent::__construct(array(), $isSingleton);
     if ($sourceImage) {
         $this->update($sourceImage->toMap());
     }
     $this->ID = -1;
     $this->Filename = $filename;
 }
 /**
  * Build the GalleryImage object based on an array
  * 
  * @param array $parameters
  * @return \Imgur\Api\Model\GalleryImage
  */
 public function __construct($parameters)
 {
     parent::__construct($parameters);
     $this->setAccountUrl($parameters['account_url'])->setUps($parameters['ups'])->setDowns($parameters['downs'])->setScore($parameters['score'])->setIsAlbum($parameters['is_album']);
     return $this;
 }
Example #23
0
 protected function __construct(\Imagick $im)
 {
     $this->im = $im;
     parent::__construct();
 }