Example #1
0
 /**
  * @param File $file
  */
 protected function process($file)
 {
     if (!($imageInfo = @getimagesize($file->getUri()))) {
         throw new ImageFileException('The uploaded file is not an image, or the file was not readable.');
     }
     if (!in_array($imageInfo[2], $this->allowedImageTypes)) {
         throw new ImageFileException('The image type you uploaded is not allowed. Allowed image types are: ' . implode(', ', $this->{$allowedImageTypes}) . '.');
     }
     $file->setWidth($imageInfo[0]);
     $file->setHeight($imageInfo[1]);
     $file->setType($imageInfo[2]);
 }