Exemplo n.º 1
0
 /**
  * @param ImageAwareLayerInterface $layer
  */
 protected function initImageAwareLayerResource(ImageAwareLayerInterface $layer)
 {
     $format = $layer->get('image.format');
     if ($layer->has('image.imc_uri')) {
         $uri = $layer->get('image.imc_uri');
         $resource = $this->rh->getGdResourceFromStream($format, $uri, true);
     } else {
         $contents = $layer->get('image.contents');
         $resource = $this->rh->getGdResourceFromContents($format, $contents, true);
     }
     if ($layer->has('image.rotate.angle')) {
         $resource = $this->rh->getRotatedGdResource($resource, $layer->get('image.rotate.angle'), $layer->get('image.rotate.bgcolor'));
     }
     if ($layer->has('image.resize.width')) {
         $resource = $this->rh->getResizedGdResource($resource, $layer->get('image.resize.width'), $layer->get('image.resize.height'), $layer->get('image.resize.option'), true);
     }
     if ($layer->has('image.flip')) {
         $resource = $this->rh->getFlippedGdResource($resource, $layer->get('image.flip'));
     }
     if ($layer->has('image.opacity')) {
         $resource = $this->rh->getOpacityGdResource($resource, $layer->get('image.opacity'));
     }
     $layer->set('final.resource', $resource);
 }
Exemplo n.º 2
0
 /**
  * @param BackgroundLayerInterface $layer
  */
 protected function renderFrameResource(BackgroundLayerInterface $layer)
 {
     if ($layer->has('image.rotate.angle')) {
         $resource = $this->rh->getRotatedGdResource($layer->get('gif.frame_resource'), $layer->get('image.rotate.angle'), $layer->get('image.rotate.bgcolor'));
         $layer->set('gif.frame_resource', $resource);
     }
     if ($layer->has('image.resize.width')) {
         $resource = $this->rh->getResizedGdResource($layer->get('gif.frame_resource'), $layer->get('image.resize.width'), $layer->get('image.resize.height'), $layer->get('image.resize.option'), $layer->get('gif.quality'));
         $layer->set('gif.frame_resource', $resource);
     }
     if ($layer->has('image.flip')) {
         $resource = $this->rh->getFlippedGdResource($layer->get('gif.frame_resource'), $layer->get('image.flip'));
         $layer->set('gif.frame_resource', $resource);
     }
     if ($layer->has('image.opacity')) {
         $resource = $this->rh->getOpacityGdResource($layer->get('gif.frame_resource'), $layer->get('image.opacity'));
         $layer->set('gif.frame_resource', $resource);
     }
 }