Sfoglia il codice sorgente

#2317 Update plugins: intervention-image from 2.4.2 to 2.5.0

Alex Trofimov 7 anni fa
parent
commit
19bb1ed0d1
96 ha cambiato i file con 368 aggiunte e 178 eliminazioni
  1. 6 3
      plugins/intervention-image/Intervention/Image/AbstractColor.php
  2. 5 4
      plugins/intervention-image/Intervention/Image/AbstractDecoder.php
  3. 3 1
      plugins/intervention-image/Intervention/Image/AbstractDriver.php
  4. 5 2
      plugins/intervention-image/Intervention/Image/AbstractEncoder.php
  5. 3 1
      plugins/intervention-image/Intervention/Image/AbstractFont.php
  6. 31 31
      plugins/intervention-image/Intervention/Image/Commands/Argument.php
  7. 1 1
      plugins/intervention-image/Intervention/Image/Commands/ChecksumCommand.php
  8. 1 1
      plugins/intervention-image/Intervention/Image/Commands/EllipseCommand.php
  9. 20 6
      plugins/intervention-image/Intervention/Image/Commands/ExifCommand.php
  10. 3 1
      plugins/intervention-image/Intervention/Image/Commands/IptcCommand.php
  11. 1 1
      plugins/intervention-image/Intervention/Image/Commands/LineCommand.php
  12. 4 3
      plugins/intervention-image/Intervention/Image/Commands/OrientateCommand.php
  13. 1 1
      plugins/intervention-image/Intervention/Image/Commands/PsrResponseCommand.php
  14. 1 1
      plugins/intervention-image/Intervention/Image/Commands/ResponseCommand.php
  15. 6 0
      plugins/intervention-image/Intervention/Image/Constraint.php
  16. 3 1
      plugins/intervention-image/Intervention/Image/File.php
  17. 3 1
      plugins/intervention-image/Intervention/Image/Filters/FilterInterface.php
  18. 2 1
      plugins/intervention-image/Intervention/Image/Gd/Color.php
  19. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/BackupCommand.php
  20. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/BlurCommand.php
  21. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/BrightnessCommand.php
  22. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/ColorizeCommand.php
  23. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/ContrastCommand.php
  24. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/CropCommand.php
  25. 3 2
      plugins/intervention-image/Intervention/Image/Gd/Commands/FillCommand.php
  26. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/FitCommand.php
  27. 2 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/GetSizeCommand.php
  28. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/GreyscaleCommand.php
  29. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/HeightenCommand.php
  30. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/InterlaceCommand.php
  31. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/InvertCommand.php
  32. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/LimitColorsCommand.php
  33. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/MaskCommand.php
  34. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/OpacityCommand.php
  35. 2 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/PickColorCommand.php
  36. 2 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/PixelCommand.php
  37. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/PixelateCommand.php
  38. 5 2
      plugins/intervention-image/Intervention/Image/Gd/Commands/ResetCommand.php
  39. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php
  40. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/ResizeCommand.php
  41. 2 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/RotateCommand.php
  42. 3 1
      plugins/intervention-image/Intervention/Image/Gd/Commands/SharpenCommand.php
  43. 8 6
      plugins/intervention-image/Intervention/Image/Gd/Commands/TrimCommand.php
  44. 5 2
      plugins/intervention-image/Intervention/Image/Gd/Driver.php
  45. 7 5
      plugins/intervention-image/Intervention/Image/Gd/Encoder.php
  46. 2 1
      plugins/intervention-image/Intervention/Image/Gd/Font.php
  47. 3 2
      plugins/intervention-image/Intervention/Image/Gd/Shapes/CircleShape.php
  48. 3 2
      plugins/intervention-image/Intervention/Image/Gd/Shapes/LineShape.php
  49. 3 2
      plugins/intervention-image/Intervention/Image/Gd/Shapes/PolygonShape.php
  50. 3 2
      plugins/intervention-image/Intervention/Image/Gd/Shapes/RectangleShape.php
  51. 13 6
      plugins/intervention-image/Intervention/Image/Image.php
  52. 6 4
      plugins/intervention-image/Intervention/Image/ImageManager.php
  53. 1 0
      plugins/intervention-image/Intervention/Image/ImageManagerStatic.php
  54. 4 2
      plugins/intervention-image/Intervention/Image/ImageServiceProvider.php
  55. 1 1
      plugins/intervention-image/Intervention/Image/ImageServiceProviderLaravel5.php
  56. 4 2
      plugins/intervention-image/Intervention/Image/ImageServiceProviderLeague.php
  57. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/BackupCommand.php
  58. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/BlurCommand.php
  59. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/BrightnessCommand.php
  60. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/ColorizeCommand.php
  61. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/ContrastCommand.php
  62. 4 2
      plugins/intervention-image/Intervention/Image/Imagick/Commands/CropCommand.php
  63. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/DestroyCommand.php
  64. 2 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/ExifCommand.php
  65. 5 3
      plugins/intervention-image/Intervention/Image/Imagick/Commands/FillCommand.php
  66. 2 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/FitCommand.php
  67. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/FlipCommand.php
  68. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/GammaCommand.php
  69. 2 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/GetSizeCommand.php
  70. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/GreyscaleCommand.php
  71. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/HeightenCommand.php
  72. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/InterlaceCommand.php
  73. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/InvertCommand.php
  74. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/LimitColorsCommand.php
  75. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/MaskCommand.php
  76. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/OpacityCommand.php
  77. 2 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/PickColorCommand.php
  78. 2 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/PixelCommand.php
  79. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/PixelateCommand.php
  80. 5 2
      plugins/intervention-image/Intervention/Image/Imagick/Commands/ResetCommand.php
  81. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php
  82. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/ResizeCommand.php
  83. 2 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/RotateCommand.php
  84. 3 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/SharpenCommand.php
  85. 2 1
      plugins/intervention-image/Intervention/Image/Imagick/Commands/TrimCommand.php
  86. 6 3
      plugins/intervention-image/Intervention/Image/Imagick/Commands/WidenCommand.php
  87. 7 3
      plugins/intervention-image/Intervention/Image/Imagick/Driver.php
  88. 7 2
      plugins/intervention-image/Intervention/Image/Imagick/Encoder.php
  89. 9 6
      plugins/intervention-image/Intervention/Image/Imagick/Font.php
  90. 2 1
      plugins/intervention-image/Intervention/Image/Imagick/Shapes/CircleShape.php
  91. 2 1
      plugins/intervention-image/Intervention/Image/Imagick/Shapes/LineShape.php
  92. 2 1
      plugins/intervention-image/Intervention/Image/Imagick/Shapes/PolygonShape.php
  93. 2 1
      plugins/intervention-image/Intervention/Image/Imagick/Shapes/RectangleShape.php
  94. 10 1
      plugins/intervention-image/Intervention/Image/Point.php
  95. 4 3
      plugins/intervention-image/Intervention/Image/Size.php
  96. 0 0
      plugins/intervention-image/config/config.php

+ 6 - 3
plugins/intervention-image/Intervention/Image/AbstractColor.php

@@ -2,6 +2,9 @@
 
 namespace Intervention\Image;
 
+use Intervention\Image\Exception\NotReadableException;
+use Intervention\Image\Exception\NotSupportedException;
+
 abstract class AbstractColor
 {
     /**
@@ -136,7 +139,7 @@ abstract class AbstractColor
                 break;
 
             default:
-                throw new \Intervention\Image\Exception\NotReadableException(
+                throw new NotReadableException(
                     "Color format ({$value}) cannot be read."
                 );
         }
@@ -172,7 +175,7 @@ abstract class AbstractColor
                 return $this;
 
             default:
-                throw new \Intervention\Image\Exception\NotSupportedException(
+                throw new NotSupportedException(
                     "Color format ({$type}) is not supported."
                 );
         }
@@ -216,7 +219,7 @@ abstract class AbstractColor
             $result[2] = ($matches[3] >= 0 && $matches[3] <= 255) ? intval($matches[3]) : 0;
             $result[3] = ($matches[4] >= 0 && $matches[4] <= 1) ? $matches[4] : 0;
         } else {
-            throw new \Intervention\Image\Exception\NotReadableException(
+            throw new NotReadableException(
                 "Unable to read color ({$value})."
             );
         }

+ 5 - 4
plugins/intervention-image/Intervention/Image/AbstractDecoder.php

@@ -3,6 +3,7 @@
 namespace Intervention\Image;
 
 use GuzzleHttp\Psr7\Stream;
+use Intervention\Image\Exception\NotReadableException;
 use Psr\Http\Message\StreamInterface;
 
 abstract class AbstractDecoder
@@ -80,7 +81,7 @@ abstract class AbstractDecoder
             return $this->initFromBinary($data);
         }
 
-        throw new \Intervention\Image\Exception\NotReadableException(
+        throw new NotReadableException(
             "Unable to init from given url (".$url.")."
         );
     }
@@ -123,7 +124,7 @@ abstract class AbstractDecoder
             return $this->initFromBinary($data);
         }
 
-        throw new \Intervention\Image\Exception\NotReadableException(
+        throw new NotReadableException(
             "Unable to init from given stream"
         );
     }
@@ -262,7 +263,7 @@ abstract class AbstractDecoder
             return false;
         }
 
-        return base64_encode(base64_decode($this->data)) === $this->data;
+        return base64_encode(base64_decode($this->data)) === str_replace(["\n", "\r"], '', $this->data);
     }
 
     /**
@@ -342,7 +343,7 @@ abstract class AbstractDecoder
                 return $this->initFromBinary(base64_decode($this->data));
 
             default:
-                throw new Exception\NotReadableException("Image source not readable");
+                throw new NotReadableException("Image source not readable");
         }
     }
 

+ 3 - 1
plugins/intervention-image/Intervention/Image/AbstractDriver.php

@@ -2,6 +2,8 @@
 
 namespace Intervention\Image;
 
+use Intervention\Image\Exception\NotSupportedException;
+
 abstract class AbstractDriver
 {
     /**
@@ -114,7 +116,7 @@ abstract class AbstractDriver
             return $classnameGlobal;
         }
 
-        throw new \Intervention\Image\Exception\NotSupportedException(
+        throw new NotSupportedException(
             "Command ({$name}) is not available for driver ({$drivername})."
         );
     }

+ 5 - 2
plugins/intervention-image/Intervention/Image/AbstractEncoder.php

@@ -2,6 +2,9 @@
 
 namespace Intervention\Image;
 
+use Intervention\Image\Exception\InvalidArgumentException;
+use Intervention\Image\Exception\NotSupportedException;
+
 abstract class AbstractEncoder
 {
     /**
@@ -167,7 +170,7 @@ abstract class AbstractEncoder
                 break;
                 
             default:
-                throw new \Intervention\Image\Exception\NotSupportedException(
+                throw new NotSupportedException(
                     "Encoding format ({$format}) is not supported."
                 );
         }
@@ -229,7 +232,7 @@ abstract class AbstractEncoder
         $quality = $quality === 0 ? 1 : $quality;
 
         if ($quality < 0 || $quality > 100) {
-            throw new \Intervention\Image\Exception\InvalidArgumentException(
+            throw new InvalidArgumentException(
                 'Quality must range from 0 to 100.'
             );
         }

+ 3 - 1
plugins/intervention-image/Intervention/Image/AbstractFont.php

@@ -2,6 +2,8 @@
 
 namespace Intervention\Image\Commands;
 
+use Intervention\Image\Commands\Argument;
+
 abstract class AbstractCommand
 {
     /**
@@ -44,7 +46,7 @@ abstract class AbstractCommand
      */
     public function argument($key)
     {
-        return new \Intervention\Image\Commands\Argument($this, $key);
+        return new Argument($this, $key);
     }
 
     /**

+ 31 - 31
plugins/intervention-image/Intervention/Image/Commands/Argument.php

@@ -2,6 +2,8 @@
 
 namespace Intervention\Image\Commands;
 
+use Intervention\Image\Exception\InvalidArgumentException;
+
 class Argument
 {
     /**
@@ -66,7 +68,7 @@ class Argument
     public function required()
     {
         if ( ! array_key_exists($this->key, $this->command->arguments)) {
-            throw new \Intervention\Image\Exception\InvalidArgumentException(
+            throw new InvalidArgumentException(
                 sprintf("Missing argument %d for %s", $this->key + 1, $this->getCommandName())
             );
         }
@@ -81,61 +83,59 @@ class Argument
      */
     public function type($type)
     {
-        $fail = false;
-
+        $valid = true;
         $value = $this->value();
 
-        if (is_null($value)) {
+        if ($value === null) {
             return $this;
         }
 
         switch (strtolower($type)) {
-
             case 'bool':
             case 'boolean':
-                $fail =  ! is_bool($value);
-                $message = sprintf('%s accepts only boolean values as argument %d.', $this->getCommandName(), $this->key + 1);
+                $valid = \is_bool($value);
+                $message = '%s accepts only boolean values as argument %d.';
                 break;
-
             case 'int':
             case 'integer':
-                $fail =  ! is_integer($value);
-                $message = sprintf('%s accepts only integer values as argument %d.', $this->getCommandName(), $this->key + 1);
+                $valid = \is_int($value);
+                $message = '%s accepts only integer values as argument %d.';
                 break;
-
             case 'num':
             case 'numeric':
-                $fail =  ! is_numeric($value);
-                $message = sprintf('%s accepts only numeric values as argument %d.', $this->getCommandName(), $this->key + 1);
+                $valid = is_numeric($value);
+                $message = '%s accepts only numeric values as argument %d.';
                 break;
-
             case 'str':
             case 'string':
-                $fail =  ! is_string($value);
-                $message = sprintf('%s accepts only string values as argument %d.', $this->getCommandName(), $this->key + 1);
+                $valid = \is_string($value);
+                $message = '%s accepts only string values as argument %d.';
                 break;
-
             case 'array':
-                $fail =  ! is_array($value);
-                $message = sprintf('%s accepts only array as argument %d.', $this->getCommandName(), $this->key + 1);
+                $valid = \is_array($value);
+                $message = '%s accepts only array as argument %d.';
                 break;
-
             case 'closure':
-                $fail =  ! is_a($value, '\Closure');
-                $message = sprintf('%s accepts only Closure as argument %d.', $this->getCommandName(), $this->key + 1);
+                $valid = is_a($value, '\Closure');
+                $message = '%s accepts only Closure as argument %d.';
                 break;
-
             case 'digit':
-                $fail = ! $this->isDigit($value);
-                $message = sprintf('%s accepts only integer values as argument %d.', $this->getCommandName(), $this->key + 1);
+                $valid = $this->isDigit($value);
+                $message = '%s accepts only integer values as argument %d.';
                 break;
         }
 
-        if ($fail) {
+        if (! $valid) {
+            $commandName = $this->getCommandName();
+            $argument = $this->key + 1;
 
-            $message = isset($message) ? $message : sprintf("Missing argument for %d.", $this->key);
+            if (isset($message)) {
+                $message = sprintf($message, $commandName, $argument);
+            } else {
+                $message = sprintf('Missing argument for %d.', $argument);
+            }
 
-            throw new \Intervention\Image\Exception\InvalidArgumentException(
+            throw new InvalidArgumentException(
                 $message
             );
         }
@@ -160,7 +160,7 @@ class Argument
         $omega = max($x, $y);
 
         if ($value < $alpha || $value > $omega) {
-            throw new \Intervention\Image\Exception\InvalidArgumentException(
+            throw new InvalidArgumentException(
                 sprintf('Argument %d must be between %s and %s.', $this->key, $x, $y)
             );
         }
@@ -182,7 +182,7 @@ class Argument
         }
 
         if ($v < $value) {
-            throw new \Intervention\Image\Exception\InvalidArgumentException(
+            throw new InvalidArgumentException(
                 sprintf('Argument %d must be at least %s.', $this->key, $value)
             );
         }
@@ -204,7 +204,7 @@ class Argument
         }
 
         if ($v > $value) {
-            throw new \Intervention\Image\Exception\InvalidArgumentException(
+            throw new InvalidArgumentException(
                 sprintf('Argument %d may not be greater than %s.', $this->key, $value)
             );
         }

+ 1 - 1
plugins/intervention-image/Intervention/Image/Commands/ChecksumCommand.php

@@ -4,7 +4,7 @@ namespace Intervention\Image\Commands;
 
 use Closure;
 
-class CircleCommand extends \Intervention\Image\Commands\AbstractCommand
+class CircleCommand extends AbstractCommand
 {
     /**
      * Draw a circle centered on given image

+ 1 - 1
plugins/intervention-image/Intervention/Image/Commands/EllipseCommand.php

@@ -4,7 +4,7 @@ namespace Intervention\Image\Commands;
 
 use Closure;
 
-class EllipseCommand extends \Intervention\Image\Commands\AbstractCommand
+class EllipseCommand extends AbstractCommand
 {
     /**
      * Draws ellipse on given image

+ 20 - 6
plugins/intervention-image/Intervention/Image/Commands/ExifCommand.php

@@ -2,6 +2,9 @@
 
 namespace Intervention\Image\Commands;
 
+use Intervention\Image\Exception\NotReadableException;
+use Intervention\Image\Exception\NotSupportedException;
+
 class ExifCommand extends AbstractCommand
 {
     /**
@@ -15,8 +18,8 @@ class ExifCommand extends AbstractCommand
      */
     public function execute($image)
     {
-        if ( ! function_exists('exif_read_data')) {
-            throw new \Intervention\Image\Exception\NotSupportedException(
+        if (!function_exists('exif_read_data')) {
+            throw new NotSupportedException(
                 "Reading Exif data is not supported by this PHP installation."
             );
         }
@@ -24,14 +27,25 @@ class ExifCommand extends AbstractCommand
         $key = $this->argument(0)->value();
 
         // try to read exif data from image file
-        $data = @exif_read_data($image->dirname .'/'. $image->basename);
+        try {
+            $data = @exif_read_data($image->dirname . '/' . $image->basename);
+
+            if (!is_null($key) && is_array($data)) {
+                $data = array_key_exists($key, $data) ? $data[$key] : false;
+            }
 
-        if (! is_null($key) && is_array($data)) {
-            $data = array_key_exists($key, $data) ? $data[$key] : false;
+        } catch (\Exception $e) {
+            throw new NotReadableException(
+                sprintf(
+                    "Cannot read the Exif data from the filename (%s) provided ",
+                    $image->dirname . '/' . $image->basename
+                ),
+                $e->getCode(),
+                $e
+            );
         }
 
         $this->setOutput($data);
-
         return true;
     }
 }

+ 3 - 1
plugins/intervention-image/Intervention/Image/Commands/IptcCommand.php

@@ -2,6 +2,8 @@
 
 namespace Intervention\Image\Commands;
 
+use Intervention\Image\Exception\NotSupportedException;
+
 class IptcCommand extends AbstractCommand
 {
     /**
@@ -13,7 +15,7 @@ class IptcCommand extends AbstractCommand
     public function execute($image)
     {
         if ( ! function_exists('iptcparse')) {
-            throw new \Intervention\Image\Exception\NotSupportedException(
+            throw new NotSupportedException(
                 "Reading Iptc data is not supported by this PHP installation."
             );
         }

+ 1 - 1
plugins/intervention-image/Intervention/Image/Commands/LineCommand.php

@@ -4,7 +4,7 @@ namespace Intervention\Image\Commands;
 
 use Closure;
 
-class LineCommand extends \Intervention\Image\Commands\AbstractCommand
+class LineCommand extends AbstractCommand
 {
     /**
      * Draws line on given image

+ 4 - 3
plugins/intervention-image/Intervention/Image/Commands/OrientateCommand.php

@@ -3,8 +3,9 @@
 namespace Intervention\Image\Commands;
 
 use Closure;
+use Intervention\Image\Exception\InvalidArgumentException;
 
-class PolygonCommand extends \Intervention\Image\Commands\AbstractCommand
+class PolygonCommand extends AbstractCommand
 {
     /**
      * Draw a polygon on given image
@@ -21,13 +22,13 @@ class PolygonCommand extends \Intervention\Image\Commands\AbstractCommand
 
         // check if number if coordinates is even
         if ($vertices_count % 2 !== 0) {
-            throw new \Intervention\Image\Exception\InvalidArgumentException(
+            throw new InvalidArgumentException(
                 "The number of given polygon vertices must be even."
             );
         }
 
         if ($vertices_count < 6) {
-            throw new \Intervention\Image\Exception\InvalidArgumentException(
+            throw new InvalidArgumentException(
                 "You must have at least 3 points in your array."
             );
         }

+ 1 - 1
plugins/intervention-image/Intervention/Image/Commands/PsrResponseCommand.php

@@ -4,7 +4,7 @@ namespace Intervention\Image\Commands;
 
 use Closure;
 
-class RectangleCommand extends \Intervention\Image\Commands\AbstractCommand
+class RectangleCommand extends AbstractCommand
 {
     /**
      * Draws rectangle on given image

+ 1 - 1
plugins/intervention-image/Intervention/Image/Commands/ResponseCommand.php

@@ -4,7 +4,7 @@ namespace Intervention\Image\Commands;
 
 use Closure;
 
-class TextCommand extends \Intervention\Image\Commands\AbstractCommand
+class TextCommand extends AbstractCommand
 {
     /**
      * Write text on given image

+ 6 - 0
plugins/intervention-image/Intervention/Image/Constraint.php

@@ -4,6 +4,12 @@ namespace Intervention\Image\Facades;
 
 use Illuminate\Support\Facades\Facade;
 
+/**
+ * @method static \Intervention\Image\Image make(mixed $data)
+ * @method static self configure(array $config)
+ * @method static \Intervention\Image\Image canvas(int $width, int $height, mixed $background = null)
+ * @method static \Intervention\Image\Image cache(\Closure $callback, int $lifetime = null, boolean $returnObj = false)
+ */
 class Image extends Facade
 {
     protected static function getFacadeAccessor()

+ 3 - 1
plugins/intervention-image/Intervention/Image/File.php

@@ -2,6 +2,8 @@
 
 namespace Intervention\Image\Filters;
 
+use Intervention\Image\Image;
+
 class DemoFilter implements FilterInterface
 {
     /**
@@ -32,7 +34,7 @@ class DemoFilter implements FilterInterface
      * @param  \Intervention\Image\Image $image
      * @return \Intervention\Image\Image
      */
-    public function applyFilter(\Intervention\Image\Image $image)
+    public function applyFilter(Image $image)
     {
         $image->pixelate($this->size);
         $image->greyscale();

+ 3 - 1
plugins/intervention-image/Intervention/Image/Filters/FilterInterface.php

@@ -2,6 +2,8 @@
 
 namespace Intervention\Image\Filters;
 
+use Intervention\Image\Image;
+
 interface FilterInterface
 {
     /**
@@ -10,5 +12,5 @@ interface FilterInterface
      * @param  \Intervention\Image\Image $image
      * @return \Intervention\Image\Image
      */
-    public function applyFilter(\Intervention\Image\Image $image);
+    public function applyFilter(Image $image);
 }

+ 2 - 1
plugins/intervention-image/Intervention/Image/Gd/Color.php

@@ -3,6 +3,7 @@
 namespace Intervention\Image\Gd;
 
 use Intervention\Image\AbstractColor;
+use Intervention\Image\Exception\NotSupportedException;
 
 class Color extends AbstractColor
 {
@@ -134,7 +135,7 @@ class Color extends AbstractColor
      */
     public function initFromObject($value)
     {
-        throw new \Intervention\Image\Exception\NotSupportedException(
+        throw new NotSupportedException(
             "GD colors cannot init from ImagickPixel objects."
         );
     }

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/BackupCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class BackupCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class BackupCommand extends AbstractCommand
 {
     /**
      * Saves a backups of current state of image core

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/BlurCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class BlurCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class BlurCommand extends AbstractCommand
 {
     /**
      * Applies blur effect on image

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/BrightnessCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class BrightnessCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class BrightnessCommand extends AbstractCommand
 {
     /**
      * Changes image brightness

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/ColorizeCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class ColorizeCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class ColorizeCommand extends AbstractCommand
 {
     /**
      * Changes balance of different RGB color channels

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/ContrastCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class ContrastCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class ContrastCommand extends AbstractCommand
 {
     /**
      * Changes contrast of image

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/CropCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class DestroyCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class DestroyCommand extends AbstractCommand
 {
     /**
      * Destroys current image core and frees up memory

+ 3 - 2
plugins/intervention-image/Intervention/Image/Gd/Commands/FillCommand.php

@@ -2,10 +2,11 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-use Intervention\Image\Gd\Decoder;
+use Intervention\Image\Commands\AbstractCommand;
 use Intervention\Image\Gd\Color;
+use Intervention\Image\Gd\Decoder;
 
-class FillCommand extends \Intervention\Image\Commands\AbstractCommand
+class FillCommand extends AbstractCommand
 {
     /**
      * Fills image with color or pattern

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/FitCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class GammaCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class GammaCommand extends AbstractCommand
 {
     /**
      * Applies gamma correction to a given image

+ 2 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/GetSizeCommand.php

@@ -2,9 +2,10 @@
 
 namespace Intervention\Image\Gd\Commands;
 
+use Intervention\Image\Commands\AbstractCommand;
 use Intervention\Image\Size;
 
-class GetSizeCommand extends \Intervention\Image\Commands\AbstractCommand
+class GetSizeCommand extends AbstractCommand
 {
     /**
      * Reads size of given image instance in pixels

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/GreyscaleCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class GreyscaleCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class GreyscaleCommand extends AbstractCommand
 {
     /**
      * Turns an image into a greyscale version

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/HeightenCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class InsertCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class InsertCommand extends AbstractCommand
 {
     /**
      * Insert another image into given image

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/InterlaceCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class InterlaceCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class InterlaceCommand extends AbstractCommand
 {
     /**
      * Toggles interlaced encoding mode

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/InvertCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class InvertCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class InvertCommand extends AbstractCommand
 {
     /**
      * Inverts colors of an image

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/LimitColorsCommand.php

@@ -2,8 +2,10 @@
 
 namespace Intervention\Image\Gd\Commands;
 
+use Intervention\Image\Commands\AbstractCommand;
 
-class LimitColorsCommand extends \Intervention\Image\Commands\AbstractCommand
+
+class LimitColorsCommand extends AbstractCommand
 {
     /**
      * Reduces colors of a given image

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/MaskCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class MaskCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class MaskCommand extends AbstractCommand
 {
     /**
      * Applies an alpha mask to an image

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/OpacityCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class OpacityCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class OpacityCommand extends AbstractCommand
 {
     /**
      * Defines opacity of an image

+ 2 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/PickColorCommand.php

@@ -2,9 +2,10 @@
 
 namespace Intervention\Image\Gd\Commands;
 
+use Intervention\Image\Commands\AbstractCommand;
 use Intervention\Image\Gd\Color;
 
-class PickColorCommand extends \Intervention\Image\Commands\AbstractCommand
+class PickColorCommand extends AbstractCommand
 {
     /**
      * Read color information from a certain position

+ 2 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/PixelCommand.php

@@ -2,9 +2,10 @@
 
 namespace Intervention\Image\Gd\Commands;
 
+use Intervention\Image\Commands\AbstractCommand;
 use Intervention\Image\Gd\Color;
 
-class PixelCommand extends \Intervention\Image\Commands\AbstractCommand
+class PixelCommand extends AbstractCommand
 {
     /**
      * Draws one pixel to a given image

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/PixelateCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class PixelateCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class PixelateCommand extends AbstractCommand
 {
     /**
      * Applies a pixelation effect to a given image

+ 5 - 2
plugins/intervention-image/Intervention/Image/Gd/Commands/ResetCommand.php

@@ -2,7 +2,10 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class ResetCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+use Intervention\Image\Exception\RuntimeException;
+
+class ResetCommand extends AbstractCommand
 {
     /**
      * Resets given image to its backup state
@@ -28,7 +31,7 @@ class ResetCommand extends \Intervention\Image\Commands\AbstractCommand
             return true;
         }
 
-        throw new \Intervention\Image\Exception\RuntimeException(
+        throw new RuntimeException(
             "Backup not available. Call backup() before reset()."
         );
     }

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class ResizeCanvasCommand extends AbstractCommand
 {
     /**
      * Resizes image boundaries

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/ResizeCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class ResizeCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class ResizeCommand extends AbstractCommand
 {
     /**
      * Resizes image dimensions

+ 2 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/RotateCommand.php

@@ -2,9 +2,10 @@
 
 namespace Intervention\Image\Gd\Commands;
 
+use Intervention\Image\Commands\AbstractCommand;
 use Intervention\Image\Gd\Color;
 
-class RotateCommand extends \Intervention\Image\Commands\AbstractCommand
+class RotateCommand extends AbstractCommand
 {
     /**
      * Rotates image counter clockwise

+ 3 - 1
plugins/intervention-image/Intervention/Image/Gd/Commands/SharpenCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Gd\Commands;
 
-class SharpenCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class SharpenCommand extends AbstractCommand
 {
     /**
      * Sharpen image

+ 8 - 6
plugins/intervention-image/Intervention/Image/Gd/Commands/TrimCommand.php

@@ -2,6 +2,8 @@
 
 namespace Intervention\Image\Gd;
 
+use Intervention\Image\Exception\NotReadableException;
+use Intervention\Image\Exception\NotSupportedException;
 use Intervention\Image\Image;
 
 class Decoder extends \Intervention\Image\AbstractDecoder
@@ -15,7 +17,7 @@ class Decoder extends \Intervention\Image\AbstractDecoder
     public function initFromPath($path)
     {
         if ( ! file_exists($path)) {
-            throw new \Intervention\Image\Exception\NotReadableException(
+            throw new NotReadableException(
                 "Unable to find file ({$path})."
             );
         }
@@ -46,7 +48,7 @@ class Decoder extends \Intervention\Image\AbstractDecoder
             case 'image/webp':
             case 'image/x-webp':
                 if ( ! function_exists('imagecreatefromwebp')) {
-                    throw new \Intervention\Image\Exception\NotReadableException(
+                    throw new NotReadableException(
                         "Unsupported image type. GD/PHP installation does not support WebP format."
                     );
                 }
@@ -54,13 +56,13 @@ class Decoder extends \Intervention\Image\AbstractDecoder
                 break;
 
             default:
-                throw new \Intervention\Image\Exception\NotReadableException(
+                throw new NotReadableException(
                     "Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files."
                 );
         }
 
         if (empty($core)) {
-            throw new \Intervention\Image\Exception\NotReadableException(
+            throw new NotReadableException(
                 "Unable to decode image from file ({$path})."
             );
         }
@@ -94,7 +96,7 @@ class Decoder extends \Intervention\Image\AbstractDecoder
      */
     public function initFromImagick(\Imagick $object)
     {
-        throw new \Intervention\Image\Exception\NotSupportedException(
+        throw new NotSupportedException(
             "Gd driver is unable to init from Imagick object."
         );
     }
@@ -110,7 +112,7 @@ class Decoder extends \Intervention\Image\AbstractDecoder
         $resource = @imagecreatefromstring($binary);
 
         if ($resource === false) {
-             throw new \Intervention\Image\Exception\NotReadableException(
+             throw new NotReadableException(
                 "Unable to init from given binary data."
             );
         }

+ 5 - 2
plugins/intervention-image/Intervention/Image/Gd/Driver.php

@@ -2,6 +2,9 @@
 
 namespace Intervention\Image\Gd;
 
+use Intervention\Image\Exception\NotSupportedException;
+use Intervention\Image\Image;
+
 class Driver extends \Intervention\Image\AbstractDriver
 {
     /**
@@ -13,7 +16,7 @@ class Driver extends \Intervention\Image\AbstractDriver
     public function __construct(Decoder $decoder = null, Encoder $encoder = null)
     {
         if ( ! $this->coreAvailable()) {
-            throw new \Intervention\Image\Exception\NotSupportedException(
+            throw new NotSupportedException(
                 "GD Library extension not available with this PHP installation."
             );
         }
@@ -34,7 +37,7 @@ class Driver extends \Intervention\Image\AbstractDriver
     {
         // create empty resource
         $core = imagecreatetruecolor($width, $height);
-        $image = new \Intervention\Image\Image(new static, $core);
+        $image = new Image(new static, $core);
 
         // set background color
         $background = new Color($background);

+ 7 - 5
plugins/intervention-image/Intervention/Image/Gd/Encoder.php

@@ -2,6 +2,8 @@
 
 namespace Intervention\Image\Gd;
 
+use Intervention\Image\Exception\NotSupportedException;
+
 class Encoder extends \Intervention\Image\AbstractEncoder
 {
     /**
@@ -58,7 +60,7 @@ class Encoder extends \Intervention\Image\AbstractEncoder
     protected function processWebp()
     {
         if ( ! function_exists('imagewebp')) {
-            throw new \Intervention\Image\Exception\NotSupportedException(
+            throw new NotSupportedException(
                 "Webp format is not supported by PHP installation."
             );
         }
@@ -79,7 +81,7 @@ class Encoder extends \Intervention\Image\AbstractEncoder
      */
     protected function processTiff()
     {
-        throw new \Intervention\Image\Exception\NotSupportedException(
+        throw new NotSupportedException(
             "TIFF format is not supported by Gd Driver."
         );
     }
@@ -91,7 +93,7 @@ class Encoder extends \Intervention\Image\AbstractEncoder
      */
     protected function processBmp()
     {
-        throw new \Intervention\Image\Exception\NotSupportedException(
+        throw new NotSupportedException(
             "BMP format is not supported by Gd Driver."
         );
     }
@@ -103,7 +105,7 @@ class Encoder extends \Intervention\Image\AbstractEncoder
      */
     protected function processIco()
     {
-        throw new \Intervention\Image\Exception\NotSupportedException(
+        throw new NotSupportedException(
             "ICO format is not supported by Gd Driver."
         );
     }
@@ -115,7 +117,7 @@ class Encoder extends \Intervention\Image\AbstractEncoder
      */
     protected function processPsd()
     {
-        throw new \Intervention\Image\Exception\NotSupportedException(
+        throw new NotSupportedException(
             "PSD format is not supported by Gd Driver."
         );
     }

+ 2 - 1
plugins/intervention-image/Intervention/Image/Gd/Font.php

@@ -2,6 +2,7 @@
 
 namespace Intervention\Image\Gd;
 
+use Intervention\Image\Exception\NotSupportedException;
 use Intervention\Image\Image;
 
 class Font extends \Intervention\Image\AbstractFont
@@ -27,7 +28,7 @@ class Font extends \Intervention\Image\AbstractFont
         $internalfont = is_numeric($internalfont) ? $internalfont : false;
 
         if ( ! in_array($internalfont, [1, 2, 3, 4, 5])) {
-            throw new \Intervention\Image\Exception\NotSupportedException(
+            throw new NotSupportedException(
                 sprintf('Internal GD font (%s) not available. Use only 1-5.', $internalfont)
             );
         }

+ 3 - 2
plugins/intervention-image/Intervention/Image/Gd/Shapes/CircleShape.php

@@ -2,10 +2,11 @@
 
 namespace Intervention\Image\Gd\Shapes;
 
-use Intervention\Image\Image;
+use Intervention\Image\AbstractShape;
 use Intervention\Image\Gd\Color;
+use Intervention\Image\Image;
 
-class EllipseShape extends \Intervention\Image\AbstractShape
+class EllipseShape extends AbstractShape
 {
     /**
      * Width of ellipse in pixels

+ 3 - 2
plugins/intervention-image/Intervention/Image/Gd/Shapes/LineShape.php

@@ -2,10 +2,11 @@
 
 namespace Intervention\Image\Gd\Shapes;
 
-use Intervention\Image\Image;
+use Intervention\Image\AbstractShape;
 use Intervention\Image\Gd\Color;
+use Intervention\Image\Image;
 
-class LineShape extends \Intervention\Image\AbstractShape
+class LineShape extends AbstractShape
 {
     /**
      * Starting point x-coordinate of line

+ 3 - 2
plugins/intervention-image/Intervention/Image/Gd/Shapes/PolygonShape.php

@@ -2,10 +2,11 @@
 
 namespace Intervention\Image\Gd\Shapes;
 
-use Intervention\Image\Image;
+use Intervention\Image\AbstractShape;
 use Intervention\Image\Gd\Color;
+use Intervention\Image\Image;
 
-class PolygonShape extends \Intervention\Image\AbstractShape
+class PolygonShape extends AbstractShape
 {
     /**
      * Array of points of polygon

+ 3 - 2
plugins/intervention-image/Intervention/Image/Gd/Shapes/RectangleShape.php

@@ -2,10 +2,11 @@
 
 namespace Intervention\Image\Gd\Shapes;
 
-use Intervention\Image\Image;
+use Intervention\Image\AbstractShape;
 use Intervention\Image\Gd\Color;
+use Intervention\Image\Image;
 
-class RectangleShape extends \Intervention\Image\AbstractShape
+class RectangleShape extends AbstractShape
 {
     /**
      * X-Coordinate of top-left point

+ 13 - 6
plugins/intervention-image/Intervention/Image/Image.php

@@ -2,6 +2,8 @@
 
 namespace Intervention\Image;
 
+use Intervention\Image\Exception\NotWritableException;
+use Intervention\Image\Exception\RuntimeException;
 use Psr\Http\Message\ResponseInterface;
 use Psr\Http\Message\StreamInterface;
 
@@ -40,7 +42,7 @@ use Psr\Http\Message\StreamInterface;
  * @method \Intervention\Image\Image polygon(array $points, \Closure $callback = null)                                                                                    Draw a colored polygon with given points. You can define the appearance of the polygon by an optional closure callback.
  * @method \Intervention\Image\Image rectangle(int $x1, int $y1, int $x2, int $y2, \Closure $callback = null)                                             Draw a colored rectangle on current image with top-left corner on x,y point 1 and bottom-right corner at x,y point 2. Define the overall appearance of the shape by passing a Closure callback as an optional parameter.
  * @method \Intervention\Image\Image reset(string $name = 'default')                                                                                                      Resets all of the modifications to a state saved previously by backup under an optional name.
- * @method \Intervention\Image\Image resize(int $width, int $height = null, \Closure $callback = null)                                                                   Resizes current image based on given width and/or height. To contraint the resize command, pass an optional Closure callback as third parameter.
+ * @method \Intervention\Image\Image resize(int $width = null, int $height = null, \Closure $callback = null)                                                                   Resizes current image based on given width and/or height. To contraint the resize command, pass an optional Closure callback as third parameter.
  * @method \Intervention\Image\Image resizeCanvas(int $width, int $height, string $anchor = 'center', boolean $relative = false, mixed $bgcolor = null)           Resize the boundaries of the current image to given width and height. An anchor can be defined to determine from what point of the image the resizing is going to happen. Set the mode to relative to add or subtract the given width or height to the actual image dimensions. You can also pass a background color for the emerging area of the image.
  * @method mixed                     response(string $format = null, int $quality = 90)                                                                               Sends HTTP response with current image in given format and quality.
  * @method \Intervention\Image\Image rotate(float $angle, mixed $bgcolor = null)                                                                                          Rotate the current image counter-clockwise by a given angle. Optionally define a background color for the uncovered zone after the rotation.
@@ -124,23 +126,28 @@ class Image extends File
      *
      * @param  string  $path
      * @param  int     $quality
+     * @param  string  $format
      * @return \Intervention\Image\Image
      */
-    public function save($path = null, $quality = null)
+    public function save($path = null, $quality = null, $format = null)
     {
         $path = is_null($path) ? $this->basePath() : $path;
 
         if (is_null($path)) {
-            throw new Exception\NotWritableException(
+            throw new NotWritableException(
                 "Can't write to undefined path."
             );
         }
 
-        $data = $this->encode(pathinfo($path, PATHINFO_EXTENSION), $quality);
+        if ($format === null) {
+            $format = pathinfo($path, PATHINFO_EXTENSION);
+        }
+
+        $data = $this->encode($format, $quality);
         $saved = @file_put_contents($path, $data);
 
         if ($saved === false) {
-            throw new Exception\NotWritableException(
+            throw new NotWritableException(
                 "Can't write image data to path ({$path})"
             );
         }
@@ -216,7 +223,7 @@ class Image extends File
         $name = is_null($name) ? 'default' : $name;
 
         if ( ! $this->backupExists($name)) {
-            throw new \Intervention\Image\Exception\RuntimeException(
+            throw new RuntimeException(
                 "Backup with name ({$name}) not available. Call backup() before reset()."
             );
         }

+ 6 - 4
plugins/intervention-image/Intervention/Image/ImageManager.php

@@ -3,6 +3,8 @@
 namespace Intervention\Image;
 
 use Closure;
+use Intervention\Image\Exception\MissingDependencyException;
+use Intervention\Image\Exception\NotSupportedException;
 
 class ImageManager
 {
@@ -90,7 +92,7 @@ class ImageManager
             return $imagecache->get($lifetime, $returnObj);
         }
 
-        throw new \Intervention\Image\Exception\MissingDependencyException(
+        throw new MissingDependencyException(
             "Please install package intervention/imagecache before running this function."
         );
     }
@@ -110,7 +112,7 @@ class ImageManager
                 return new $driverclass;
             }
 
-            throw new \Intervention\Image\Exception\NotSupportedException(
+            throw new NotSupportedException(
                 "Driver ({$drivername}) could not be instantiated."
             );
         }
@@ -119,7 +121,7 @@ class ImageManager
             return $this->config['driver'];
         }
 
-        throw new \Intervention\Image\Exception\NotSupportedException(
+        throw new NotSupportedException(
             "Unknown driver type."
         );
     }
@@ -132,7 +134,7 @@ class ImageManager
     private function checkRequirements()
     {
         if ( ! function_exists('finfo_buffer')) {
-            throw new \Intervention\Image\Exception\MissingDependencyException(
+            throw new MissingDependencyException(
                 "PHP Fileinfo extension must be installed/enabled to use Intervention Image."
             );
         }

+ 1 - 0
plugins/intervention-image/Intervention/Image/ImageManagerStatic.php

@@ -51,6 +51,7 @@ class ImageManagerStatic
      * @param  mixed $data
      *
      * @return \Intervention\Image\Image
+     * @throws \Intervention\Image\Exception\NotReadableException
      */
     public static function make($data)
     {

+ 4 - 2
plugins/intervention-image/Intervention/Image/ImageServiceProvider.php

@@ -3,6 +3,8 @@
 namespace Intervention\Image;
 
 use Illuminate\Support\ServiceProvider;
+use Laravel\Lumen\Application as LumenApplication;
+use Illuminate\Foundation\Application as IlluminateApplication;
 
 class ImageServiceProvider extends ServiceProvider
 {
@@ -62,9 +64,9 @@ class ImageServiceProvider extends ServiceProvider
      */
     private function getProvider()
     {
-        if ($this->app instanceof \Laravel\Lumen\Application) {
+        if ($this->app instanceof LumenApplication) {
             $provider = '\Intervention\Image\ImageServiceProviderLumen';
-        } elseif (version_compare(\Illuminate\Foundation\Application::VERSION, '5.0', '<')) {
+        } elseif (version_compare(IlluminateApplication::VERSION, '5.0', '<')) {
             $provider = '\Intervention\Image\ImageServiceProviderLaravel4';
         } else {
             $provider = '\Intervention\Image\ImageServiceProviderLaravel5';

+ 1 - 1
plugins/intervention-image/Intervention/Image/ImageServiceProviderLaravel5.php

@@ -59,7 +59,7 @@ class ImageServiceProviderLaravel5 extends ServiceProvider
      *
      * @return void
      */
-    private function bootstrapImageCache()
+    protected function bootstrapImageCache()
     {
         $app = $this->app;
         $config = __DIR__.'/../../../../imagecache/src/config/config.php';

+ 4 - 2
plugins/intervention-image/Intervention/Image/ImageServiceProviderLeague.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick;
 
-class Color extends \Intervention\Image\AbstractColor
+use Intervention\Image\AbstractColor;
+
+class Color extends AbstractColor
 {
     /**
      * ImagickPixel containing current color information
@@ -178,7 +180,7 @@ class Color extends \Intervention\Image\AbstractColor
      * @param  int           $tolerance
      * @return boolean
      */
-    public function differs(\Intervention\Image\AbstractColor $color, $tolerance = 0)
+    public function differs(AbstractColor $color, $tolerance = 0)
     {
         $color_tolerance = round($tolerance * 2.55);
         $alpha_tolerance = round($tolerance);

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/BackupCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class BackupCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class BackupCommand extends AbstractCommand
 {
     /**
      * Saves a backups of current state of image core

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/BlurCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class BlurCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class BlurCommand extends AbstractCommand
 {
     /**
      * Applies blur effect on image

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/BrightnessCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class BrightnessCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class BrightnessCommand extends AbstractCommand
 {
     /**
      * Changes image brightness

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/ColorizeCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class ColorizeCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class ColorizeCommand extends AbstractCommand
 {
     /**
      * Changes balance of different RGB color channels

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/ContrastCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class ContrastCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class ContrastCommand extends AbstractCommand
 {
     /**
      * Changes contrast of image

+ 4 - 2
plugins/intervention-image/Intervention/Image/Imagick/Commands/CropCommand.php

@@ -2,10 +2,12 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
+use Intervention\Image\Commands\AbstractCommand;
+use Intervention\Image\Exception\InvalidArgumentException;
 use Intervention\Image\Point;
 use Intervention\Image\Size;
 
-class CropCommand extends \Intervention\Image\Commands\AbstractCommand
+class CropCommand extends AbstractCommand
 {
     /**
      * Crop an image instance
@@ -21,7 +23,7 @@ class CropCommand extends \Intervention\Image\Commands\AbstractCommand
         $y = $this->argument(3)->type('digit')->value();
 
         if (is_null($width) || is_null($height)) {
-            throw new \Intervention\Image\Exception\InvalidArgumentException(
+            throw new InvalidArgumentException(
                 "Width and height of cutout needs to be defined."
             );
         }

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/DestroyCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class DestroyCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class DestroyCommand extends AbstractCommand
 {
     /**
      * Destroys current image core and frees up memory

+ 2 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/ExifCommand.php

@@ -3,6 +3,7 @@
 namespace Intervention\Image\Imagick\Commands;
 
 use Intervention\Image\Commands\ExifCommand as BaseCommand;
+use Intervention\Image\Exception\NotSupportedException;
 
 class ExifCommand extends BaseCommand
 {
@@ -35,7 +36,7 @@ class ExifCommand extends BaseCommand
         $core = $image->getCore();
 
         if ( ! method_exists($core, 'getImageProperties')) {
-            throw new \Intervention\Image\Exception\NotSupportedException(
+            throw new NotSupportedException(
                 "Reading Exif data is not supported by this PHP installation."
             );
         }

+ 5 - 3
plugins/intervention-image/Intervention/Image/Imagick/Commands/FillCommand.php

@@ -2,11 +2,13 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
+use Intervention\Image\Commands\AbstractCommand;
+use Intervention\Image\Exception\NotReadableException;
 use Intervention\Image\Image;
-use Intervention\Image\Imagick\Decoder;
 use Intervention\Image\Imagick\Color;
+use Intervention\Image\Imagick\Decoder;
 
-class FillCommand extends \Intervention\Image\Commands\AbstractCommand
+class FillCommand extends AbstractCommand
 {
     /**
      * Fills image with color or pattern
@@ -27,7 +29,7 @@ class FillCommand extends \Intervention\Image\Commands\AbstractCommand
             $source = new Decoder;
             $filling = $source->init($filling);
 
-        } catch (\Intervention\Image\Exception\NotReadableException $e) {
+        } catch (NotReadableException $e) {
 
             // set solid color filling
             $filling = new Color($filling);

+ 2 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/FitCommand.php

@@ -2,9 +2,10 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
+use Intervention\Image\Commands\AbstractCommand;
 use Intervention\Image\Size;
 
-class FitCommand extends \Intervention\Image\Commands\AbstractCommand
+class FitCommand extends AbstractCommand
 {
     /**
      * Crops and resized an image at the same time

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/FlipCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class FlipCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class FlipCommand extends AbstractCommand
 {
     /**
      * Mirrors an image

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/GammaCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class GammaCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class GammaCommand extends AbstractCommand
 {
     /**
      * Applies gamma correction to a given image

+ 2 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/GetSizeCommand.php

@@ -2,9 +2,10 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
+use Intervention\Image\Commands\AbstractCommand;
 use Intervention\Image\Size;
 
-class GetSizeCommand extends \Intervention\Image\Commands\AbstractCommand
+class GetSizeCommand extends AbstractCommand
 {
     /**
      * Reads size of given image instance in pixels

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/GreyscaleCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class GreyscaleCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class GreyscaleCommand extends AbstractCommand
 {
     /**
      * Turns an image into a greyscale version

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/HeightenCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class InsertCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class InsertCommand extends AbstractCommand
 {
     /**
      * Insert another image into given image

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/InterlaceCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class InterlaceCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class InterlaceCommand extends AbstractCommand
 {
     /**
      * Toggles interlaced encoding mode

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/InvertCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class InvertCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class InvertCommand extends AbstractCommand
 {
     /**
      * Inverts colors of an image

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/LimitColorsCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class LimitColorsCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class LimitColorsCommand extends AbstractCommand
 {
     /**
      * Reduces colors of a given image

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/MaskCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class MaskCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class MaskCommand extends AbstractCommand
 {
     /**
      * Applies an alpha mask to an image

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/OpacityCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class OpacityCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class OpacityCommand extends AbstractCommand
 {
     /**
      * Defines opacity of an image

+ 2 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/PickColorCommand.php

@@ -2,9 +2,10 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
+use Intervention\Image\Commands\AbstractCommand;
 use Intervention\Image\Imagick\Color;
 
-class PickColorCommand extends \Intervention\Image\Commands\AbstractCommand
+class PickColorCommand extends AbstractCommand
 {
     /**
      * Read color information from a certain position

+ 2 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/PixelCommand.php

@@ -2,9 +2,10 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
+use Intervention\Image\Commands\AbstractCommand;
 use Intervention\Image\Imagick\Color;
 
-class PixelCommand extends \Intervention\Image\Commands\AbstractCommand
+class PixelCommand extends AbstractCommand
 {
     /**
      * Draws one pixel to a given image

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/PixelateCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class PixelateCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class PixelateCommand extends AbstractCommand
 {
     /**
      * Applies a pixelation effect to a given image

+ 5 - 2
plugins/intervention-image/Intervention/Image/Imagick/Commands/ResetCommand.php

@@ -2,7 +2,10 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class ResetCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+use Intervention\Image\Exception\RuntimeException;
+
+class ResetCommand extends AbstractCommand
 {
     /**
      * Resets given image to its backup state
@@ -30,7 +33,7 @@ class ResetCommand extends \Intervention\Image\Commands\AbstractCommand
             return true;
         }
 
-        throw new \Intervention\Image\Exception\RuntimeException(
+        throw new RuntimeException(
             "Backup not available. Call backup({$backupName}) before reset()."
         );
     }

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class ResizeCanvasCommand extends AbstractCommand
 {
     /**
      * Resizes image boundaries

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/ResizeCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class ResizeCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class ResizeCommand extends AbstractCommand
 {
     /**
      * Resizes image dimensions

+ 2 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/RotateCommand.php

@@ -2,9 +2,10 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
+use Intervention\Image\Commands\AbstractCommand;
 use Intervention\Image\Imagick\Color;
 
-class RotateCommand extends \Intervention\Image\Commands\AbstractCommand
+class RotateCommand extends AbstractCommand
 {
     /**
      * Rotates image counter clockwise

+ 3 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/SharpenCommand.php

@@ -2,7 +2,9 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
-class SharpenCommand extends \Intervention\Image\Commands\AbstractCommand
+use Intervention\Image\Commands\AbstractCommand;
+
+class SharpenCommand extends AbstractCommand
 {
     /**
      * Sharpen image

+ 2 - 1
plugins/intervention-image/Intervention/Image/Imagick/Commands/TrimCommand.php

@@ -2,9 +2,10 @@
 
 namespace Intervention\Image\Imagick\Commands;
 
+use Intervention\Image\Commands\AbstractCommand;
 use Intervention\Image\Imagick\Color;
 
-class TrimCommand extends \Intervention\Image\Commands\AbstractCommand
+class TrimCommand extends AbstractCommand
 {
     /**
      * Trims away parts of an image

+ 6 - 3
plugins/intervention-image/Intervention/Image/Imagick/Commands/WidenCommand.php

@@ -2,9 +2,12 @@
 
 namespace Intervention\Image\Imagick;
 
+use Intervention\Image\AbstractDecoder;
+use Intervention\Image\Exception\NotReadableException;
+use Intervention\Image\Exception\NotSupportedException;
 use Intervention\Image\Image;
 
-class Decoder extends \Intervention\Image\AbstractDecoder
+class Decoder extends AbstractDecoder
 {
     /**
      * Initiates new image from path in filesystem
@@ -45,7 +48,7 @@ class Decoder extends \Intervention\Image\AbstractDecoder
      */
     public function initFromGdResource($resource)
     {
-        throw new \Intervention\Image\Exception\NotSupportedException(
+        throw new NotSupportedException(
             'Imagick driver is unable to init from GD resource.'
         );
     }
@@ -84,7 +87,7 @@ class Decoder extends \Intervention\Image\AbstractDecoder
             $core->readImageBlob($binary);
 
         } catch (\ImagickException $e) {
-            throw new \Intervention\Image\Exception\NotReadableException(
+            throw new NotReadableException(
                 "Unable to read image from binary data.",
                 0,
                 $e

+ 7 - 3
plugins/intervention-image/Intervention/Image/Imagick/Driver.php

@@ -2,7 +2,11 @@
 
 namespace Intervention\Image\Imagick;
 
-class Driver extends \Intervention\Image\AbstractDriver
+use Intervention\Image\AbstractDriver;
+use Intervention\Image\Exception\NotSupportedException;
+use Intervention\Image\Image;
+
+class Driver extends AbstractDriver
 {
     /**
      * Creates new instance of driver
@@ -13,7 +17,7 @@ class Driver extends \Intervention\Image\AbstractDriver
     public function __construct(Decoder $decoder = null, Encoder $encoder = null)
     {
         if ( ! $this->coreAvailable()) {
-            throw new \Intervention\Image\Exception\NotSupportedException(
+            throw new NotSupportedException(
                 "ImageMagick module not available with this PHP installation."
             );
         }
@@ -42,7 +46,7 @@ class Driver extends \Intervention\Image\AbstractDriver
         $core->setColorspace(\Imagick::COLORSPACE_UNDEFINED);
 
         // build image
-        $image = new \Intervention\Image\Image(new static, $core);
+        $image = new Image(new static, $core);
 
         return $image;
     }

+ 7 - 2
plugins/intervention-image/Intervention/Image/Imagick/Encoder.php

@@ -2,7 +2,10 @@
 
 namespace Intervention\Image\Imagick;
 
-class Encoder extends \Intervention\Image\AbstractEncoder
+use Intervention\Image\AbstractEncoder;
+use Intervention\Image\Exception\NotSupportedException;
+
+class Encoder extends AbstractEncoder
 {
     /**
      * Processes and returns encoded image as JPEG string
@@ -69,7 +72,7 @@ class Encoder extends \Intervention\Image\AbstractEncoder
     protected function processWebp()
     {
         if ( ! \Imagick::queryFormats('WEBP')) {
-            throw new \Intervention\Image\Exception\NotSupportedException(
+            throw new NotSupportedException(
                 "Webp format is not supported by Imagick installation."
             );
         }
@@ -78,6 +81,8 @@ class Encoder extends \Intervention\Image\AbstractEncoder
         $compression = \Imagick::COMPRESSION_JPEG;
 
         $imagick = $this->image->getCore();
+        $imagick->setImageBackgroundColor(new \ImagickPixel('transparent'));
+
         $imagick = $imagick->mergeImageLayers(\Imagick::LAYERMETHOD_MERGE);
         $imagick->setFormat($format);
         $imagick->setImageFormat($format);

+ 9 - 6
plugins/intervention-image/Intervention/Image/Imagick/Font.php

@@ -2,9 +2,11 @@
 
 namespace Intervention\Image\Imagick;
 
+use Intervention\Image\AbstractFont;
+use Intervention\Image\Exception\RuntimeException;
 use Intervention\Image\Image;
 
-class Font extends \Intervention\Image\AbstractFont
+class Font extends AbstractFont
 {
     /**
      * Draws font to given image at given position
@@ -25,7 +27,7 @@ class Font extends \Intervention\Image\AbstractFont
         if ($this->hasApplicableFontFile()) {
             $draw->setFont($this->file);
         } else {
-            throw new \Intervention\Image\Exception\RuntimeException(
+            throw new RuntimeException(
                 "Font file must be provided to apply text to image."
             );
         }
@@ -56,17 +58,18 @@ class Font extends \Intervention\Image\AbstractFont
         // align vertical
         if (strtolower($this->valign) != 'bottom') {
 
-            // calculate box size
-            $dimensions = $image->getCore()->queryFontMetrics($draw, $this->text);
-
             // corrections on y-position
             switch (strtolower($this->valign)) {
                 case 'center':
                 case 'middle':
+                // calculate box size
+                $dimensions = $image->getCore()->queryFontMetrics($draw, $this->text);
                 $posy = $posy + $dimensions['textHeight'] * 0.65 / 2;
                 break;
 
                 case 'top':
+                // calculate box size
+                $dimensions = $image->getCore()->queryFontMetrics($draw, $this->text, false);
                 $posy = $posy + $dimensions['textHeight'] * 0.65;
                 break;
             }
@@ -94,7 +97,7 @@ class Font extends \Intervention\Image\AbstractFont
         if ($this->hasApplicableFontFile()) {
             $draw->setFont($this->file);
         } else {
-            throw new \Intervention\Image\Exception\RuntimeException(
+            throw new RuntimeException(
                 "Font file must be provided to apply text to image."
             );
         }

+ 2 - 1
plugins/intervention-image/Intervention/Image/Imagick/Shapes/CircleShape.php

@@ -2,10 +2,11 @@
 
 namespace Intervention\Image\Imagick\Shapes;
 
+use Intervention\Image\AbstractShape;
 use Intervention\Image\Image;
 use Intervention\Image\Imagick\Color;
 
-class EllipseShape extends \Intervention\Image\AbstractShape
+class EllipseShape extends AbstractShape
 {
     /**
      * Width of ellipse in pixels

+ 2 - 1
plugins/intervention-image/Intervention/Image/Imagick/Shapes/LineShape.php

@@ -2,10 +2,11 @@
 
 namespace Intervention\Image\Imagick\Shapes;
 
+use Intervention\Image\AbstractShape;
 use Intervention\Image\Image;
 use Intervention\Image\Imagick\Color;
 
-class LineShape extends \Intervention\Image\AbstractShape
+class LineShape extends AbstractShape
 {
     /**
      * Starting point x-coordinate of line

+ 2 - 1
plugins/intervention-image/Intervention/Image/Imagick/Shapes/PolygonShape.php

@@ -2,10 +2,11 @@
 
 namespace Intervention\Image\Imagick\Shapes;
 
+use Intervention\Image\AbstractShape;
 use Intervention\Image\Image;
 use Intervention\Image\Imagick\Color;
 
-class PolygonShape extends \Intervention\Image\AbstractShape
+class PolygonShape extends AbstractShape
 {
     /**
      * Array of points of polygon

+ 2 - 1
plugins/intervention-image/Intervention/Image/Imagick/Shapes/RectangleShape.php

@@ -2,10 +2,11 @@
 
 namespace Intervention\Image\Imagick\Shapes;
 
+use Intervention\Image\AbstractShape;
 use Intervention\Image\Image;
 use Intervention\Image\Imagick\Color;
 
-class RectangleShape extends \Intervention\Image\AbstractShape
+class RectangleShape extends AbstractShape
 {
     /**
      * X-Coordinate of top-left point

+ 10 - 1
plugins/intervention-image/Intervention/Image/Point.php

@@ -2,6 +2,9 @@
 
 namespace Intervention\Image;
 
+use Illuminate\Support\Facades\Response as IlluminateResponse;
+use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
+
 class Response
 {
     /**
@@ -53,10 +56,16 @@ class Response
 
         if (function_exists('app') && is_a($app = app(), 'Illuminate\Foundation\Application')) {
 
-            $response = \Illuminate\Support\Facades\Response::make($data);
+            $response = IlluminateResponse::make($data);
             $response->header('Content-Type', $mime);
             $response->header('Content-Length', $length);
 
+        } elseif (class_exists('\Symfony\Component\HttpFoundation\Response')) {
+
+            $response = SymfonyResponse::create($data);
+            $response->headers->set('Content-Type', $mime);
+            $response->headers->set('Content-Length', $length);
+
         } else {
 
             header('Content-Type: ' . $mime);

+ 4 - 3
plugins/intervention-image/Intervention/Image/Size.php

@@ -3,6 +3,7 @@
 namespace Intervention\Image;
 
 use Closure;
+use Intervention\Image\Exception\InvalidArgumentException;
 
 class Size
 {
@@ -104,7 +105,7 @@ class Size
     public function resize($width, $height, Closure $callback = null)
     {
         if (is_null($width) && is_null($height)) {
-            throw new \Intervention\Image\Exception\InvalidArgumentException(
+            throw new InvalidArgumentException(
                 "Width or height needs to be defined."
             );
         }
@@ -154,7 +155,7 @@ class Size
             }
 
             if ($constraint->isFixed(Constraint::ASPECTRATIO)) {
-                $h = intval(round($this->width / $constraint->getSize()->getRatio()));
+                $h = max(1, intval(round($this->width / $constraint->getSize()->getRatio())));
 
                 if ($constraint->isFixed(Constraint::UPSIZE)) {
                     $this->height = ($h > $max_height) ? $max_height : $h;
@@ -190,7 +191,7 @@ class Size
             }
 
             if ($constraint->isFixed(Constraint::ASPECTRATIO)) {
-                $w = intval(round($this->height * $constraint->getSize()->getRatio()));
+                $w = max(1, intval(round($this->height * $constraint->getSize()->getRatio())));
 
                 if ($constraint->isFixed(Constraint::UPSIZE)) {
                     $this->width = ($w > $max_width) ? $max_width : $w;

+ 0 - 0
plugins/intervention-image/config/config.php