mirror of
https://github.com/Intervention/image.git
synced 2025-01-17 20:28:21 +01:00
commit
5f5e1c8768
@ -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})."
|
||||
);
|
||||
}
|
||||
|
@ -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"
|
||||
);
|
||||
}
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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})."
|
||||
);
|
||||
}
|
||||
|
@ -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.'
|
||||
);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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())
|
||||
);
|
||||
}
|
||||
@ -133,7 +135,7 @@ class Argument
|
||||
$message = sprintf('Missing argument for %d.', $argument);
|
||||
}
|
||||
|
||||
throw new \Intervention\Image\Exception\InvalidArgumentException(
|
||||
throw new InvalidArgumentException(
|
||||
$message
|
||||
);
|
||||
}
|
||||
@ -158,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)
|
||||
);
|
||||
}
|
||||
@ -180,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)
|
||||
);
|
||||
}
|
||||
@ -202,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)
|
||||
);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace Intervention\Image\Commands;
|
||||
|
||||
use Intervention\Image\Exception\NotReadableException;
|
||||
use Intervention\Image\Exception\NotSupportedException;
|
||||
|
||||
class ExifCommand extends AbstractCommand
|
||||
{
|
||||
@ -18,7 +19,7 @@ class ExifCommand extends AbstractCommand
|
||||
public function execute($image)
|
||||
{
|
||||
if (!function_exists('exif_read_data')) {
|
||||
throw new \Intervention\Image\Exception\NotSupportedException(
|
||||
throw new NotSupportedException(
|
||||
"Reading Exif data is not supported by this PHP installation."
|
||||
);
|
||||
}
|
||||
|
@ -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."
|
||||
);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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."
|
||||
);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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."
|
||||
);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,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,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
|
||||
|
@ -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
|
||||
|
@ -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()."
|
||||
);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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,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
|
||||
|
@ -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
|
||||
|
@ -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."
|
||||
);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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,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)
|
||||
);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
@ -131,7 +133,7 @@ class Image extends File
|
||||
$path = is_null($path) ? $this->basePath() : $path;
|
||||
|
||||
if (is_null($path)) {
|
||||
throw new Exception\NotWritableException(
|
||||
throw new NotWritableException(
|
||||
"Can't write to undefined path."
|
||||
);
|
||||
}
|
||||
@ -140,7 +142,7 @@ class Image extends File
|
||||
$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 +218,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()."
|
||||
);
|
||||
}
|
||||
|
@ -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."
|
||||
);
|
||||
}
|
||||
|
@ -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';
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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."
|
||||
);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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."
|
||||
);
|
||||
}
|
||||
|
@ -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,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
|
||||
|
@ -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
|
||||
|
@ -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,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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,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,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
|
||||
|
@ -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
|
||||
|
@ -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()."
|
||||
);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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,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
|
||||
|
@ -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,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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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."
|
||||
);
|
||||
}
|
||||
|
@ -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."
|
||||
);
|
||||
}
|
||||
@ -95,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,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,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,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,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
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
namespace Intervention\Image;
|
||||
|
||||
use Illuminate\Support\Facades\Response as IlluminateResponse;
|
||||
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
|
||||
|
||||
class Response
|
||||
{
|
||||
/**
|
||||
@ -53,13 +56,13 @@ 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 = \Symfony\Component\HttpFoundation\Response::create($data);
|
||||
$response = SymfonyResponse::create($data);
|
||||
$response->headers->set('Content-Type', $mime);
|
||||
$response->headers->set('Content-Length', $length);
|
||||
|
||||
|
@ -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."
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user