Beispiel #1
0
 /**
  * Defines opacity of an image
  *
  * @param  \Intervention\Image\Image $image
  * @return boolean
  */
 public function execute($image)
 {
     $transparency = $this->argument(0)->between(0, 100)->required()->value();
     // get size of image
     $size = $image->getSize();
     // build temp alpha mask
     $mask_color = sprintf('rgba(0, 0, 0, %.1f)', $transparency / 100);
     $mask = $image->getDriver()->newImage($size->width, $size->height, $mask_color);
     // mask image
     $image->mask($mask->getCore(), true);
     return true;
 }
Beispiel #2
0
 /**
  * Apply given image as alpha mask on current image
  *
  * @param mixed $source
  * @param boolean $mask_with_alpha
  * @return \Intervention\Image\Image 
  * @static 
  */
 public static function mask($source, $mask_with_alpha = false)
 {
     return \Intervention\Image\Image::mask($source, $mask_with_alpha);
 }