예제 #1
0
 /**
  * Run the application
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  * @return string
  */
 public static function run(Request $request)
 {
     self::loadEnv();
     // Set things up for the resizer
     Configurator::validateEnvironment();
     $configurator = new Configurator($request);
     $configurator->setupFile(getenv('ALLOWED_HOSTS'));
     $configurator->setHeaders();
     $image = new Image($configurator->file);
     return $image->alterImage($configurator->config)->toBlob();
 }
예제 #2
0
 public function testItGarbageCollectsImagickInstance()
 {
     $file = $this->getImageFile(300, 500);
     $image = new Image($file, false);
     $options = ['height' => '200', 'width' => '400', 'crop' => false];
     $image->alterImage($options)->clear();
     // Instance is now clear and we shouldn't be able to get an image blob
     $this->setExpectedException(\ImagickException::class, 'Can not process empty Imagick object');
     $image->getImageHandler()->getImageBlob();
 }