Exemplo n.º 1
0
 /**
  * Is current image format supported by image processor
  * @param string $filename Path to file
  */
 public function isSupportedImageFormat($filename)
 {
     $info = new ImageInfo($filename);
     if ($info->hasError()) {
         $this->container->getLogger()->error($info->getError());
         return false;
     }
     if (!$this->isMimeTypeImage($info->getMime())) {
         return false;
     }
     return ImageProcessor\ImageProcessor::isSupportedImageType($info->getType());
 }
Exemplo n.º 2
0
 /**
  * Reset this instance
  */
 public function reset()
 {
     parent::reset();
     $this->rotationCount = 1;
 }
Exemplo n.º 3
0
 /**
  * @param resource $image
  * @param string $fileName
  * @param integer $mimeType
  * @return string
  * @throws ImageProcessorException
  */
 protected function saveImageToFile($image, $fileName, $mimeType)
 {
     if (!ImageProcessor::isSupportedImageType($mimeType)) {
         throw new ImageProcessorException("Type {$mimeType} images are not supported");
     }
     switch ($mimeType) {
         case IMAGETYPE_GIF:
             return imagegif($image, $fileName);
         case IMAGETYPE_JPEG:
             return imagejpeg($image, $fileName, 90);
         case IMAGETYPE_PNG:
             return imagepng($image, $fileName, 0);
     }
 }
Exemplo n.º 4
0
 /**
  * Reset this instance
  * 
  */
 public function reset()
 {
     parent::reset();
     $this->targetWidth = null;
     $this->targetHeight = null;
     $this->cropMode = false;
 }
Exemplo n.º 5
0
 /**
  * Reset this instance
  * 
  */
 public function reset()
 {
     parent::reset();
     $this->left = null;
     $this->top = null;
     $this->right = null;
     $this->bottom = null;
     $this->width = null;
     $this->height = null;
 }