Esempio n. 1
0
 /**
  * @param $imgProps
  * @param $src
  * @param $imageToLoad
  * @throws ImageAlreadyExistsException
  * @throws ImageNotFoundException
  */
 private function saveImage(array $imgProps, $src, Image $imageToLoad)
 {
     if (file_exists(ROOT . $src)) {
         throw new ImageAlreadyExistsException("Image " . pathinfo($src, PATHINFO_BASENAME) . " already exists");
     }
     $imageToLoad->saveAs(ROOT . $src, $imgProps['height'], $imgProps['width']);
     if (!file_exists(ROOT . $src)) {
         throw new ImageNotFoundException("Unable to save image " . ROOT . $src);
     }
 }
Esempio n. 2
0
 public function testSaveThumb()
 {
     $image = new Image(self::$inputDir . 'example.jpg');
     $image->saveAs(self::$outputDir . 'thumb.png', 200, 200);
     $this->assertTrue(file_exists(self::$outputDir . 'thumb.png'));
 }