1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-01 11:30:16 +02:00

fixed coding standards

This commit is contained in:
Oliver Vogel
2014-05-18 18:07:03 +02:00
parent 28172a9efc
commit 4e252a3ffa
51 changed files with 148 additions and 148 deletions

View File

@@ -134,7 +134,7 @@ abstract class AbstractColor
case is_null($value):
$this->initFromArray(array(0, 0, 0, 0));
break;
default:
throw new \Intervention\Image\Exception\NotReadableException(
"Color format ({$value}) cannot be read."
@@ -154,7 +154,7 @@ abstract class AbstractColor
public function format($type)
{
switch (strtolower($type)) {
case 'rgba':
return $this->getRgba();
break;
@@ -167,7 +167,7 @@ abstract class AbstractColor
case 'integer':
return $this->getInt();
break;
case 'array':
return $this->getArray();
break;

View File

@@ -42,7 +42,7 @@ abstract class AbstractDriver
* @return boolean
*/
abstract protected function coreAvailable();
/**
* Initiates new image from given input
*

View File

@@ -86,8 +86,8 @@ abstract class AbstractEncoder
*/
protected function processDataUrl()
{
return sprintf('data:%s;base64,%s',
$this->image->mime,
return sprintf('data:%s;base64,%s',
$this->image->mime,
base64_encode($this->process($this->image, null, $this->quality))
);
}

View File

@@ -183,5 +183,5 @@ abstract class AbstractFont
}
return false;
}
}
}

View File

@@ -88,7 +88,7 @@ class Argument
}
switch (strtolower($type)) {
case 'bool':
case 'boolean':
$fail = ! is_bool($value);

View File

@@ -19,7 +19,7 @@ class CircleCommand extends \Intervention\Image\Commands\AbstractCommand
$y = $this->argument(2)->type('numeric')->required()->value();
$callback = $this->argument(3)->type('closure')->value();
$circle_classname = sprintf('\Intervention\Image\%s\Shapes\CircleShape',
$circle_classname = sprintf('\Intervention\Image\%s\Shapes\CircleShape',
$image->getDriver()->getDriverName());
$circle = new $circle_classname($radius);

View File

@@ -20,7 +20,7 @@ class EllipseCommand extends \Intervention\Image\Commands\AbstractCommand
$y = $this->argument(3)->type('numeric')->required()->value();
$callback = $this->argument(4)->type('closure')->value();
$ellipse_classname = sprintf('\Intervention\Image\%s\Shapes\EllipseShape',
$ellipse_classname = sprintf('\Intervention\Image\%s\Shapes\EllipseShape',
$image->getDriver()->getDriverName());
$ellipse = new $ellipse_classname($width, $height);

View File

@@ -20,7 +20,7 @@ class LineCommand extends \Intervention\Image\Commands\AbstractCommand
$y2 = $this->argument(3)->type('numeric')->required()->value();
$callback = $this->argument(4)->type('closure')->value();
$line_classname = sprintf('\Intervention\Image\%s\Shapes\LineShape',
$line_classname = sprintf('\Intervention\Image\%s\Shapes\LineShape',
$image->getDriver()->getDriverName());
$line = new $line_classname($x2, $y2);

View File

@@ -20,7 +20,7 @@ class RectangleCommand extends \Intervention\Image\Commands\AbstractCommand
$y2 = $this->argument(3)->type('numeric')->required()->value();
$callback = $this->argument(4)->type('closure')->value();
$rectangle_classname = sprintf('\Intervention\Image\%s\Shapes\RectangleShape',
$rectangle_classname = sprintf('\Intervention\Image\%s\Shapes\RectangleShape',
$image->getDriver()->getDriverName());
$rectangle = new $rectangle_classname($x1, $y1, $x2, $y2);

View File

@@ -18,7 +18,7 @@ class TextCommand extends \Intervention\Image\Commands\AbstractCommand
$y = $this->argument(2)->type('numeric')->value(0);
$callback = $this->argument(3)->type('closure')->value();
$fontclassname = sprintf('\Intervention\Image\%s\Font',
$fontclassname = sprintf('\Intervention\Image\%s\Font',
$image->getDriver()->getDriverName());
$font = new $fontclassname($text);

View File

@@ -33,7 +33,7 @@ class Constraint
*
* @param Size $size
*/
public function __construct(Size $size)
public function __construct(Size $size)
{
$this->size = $size;
}

View File

@@ -41,7 +41,7 @@ class FillCommand extends \Intervention\Image\Commands\AbstractCommand
imagealphablending($resource, true);
if (is_int($x) && is_int($y)) {
// resource should be visible through transparency
$base = $image->getDriver()->newImage($width, $height)->getCore();
imagecopy($base, $resource, 0, 0, 0, 0, $width, $height);

View File

@@ -15,7 +15,7 @@ class GetSizeCommand extends \Intervention\Image\Commands\AbstractCommand
public function execute($image)
{
$this->setOutput(new Size(
imagesx($image->getCore()),
imagesx($image->getCore()),
imagesy($image->getCore())
));

View File

@@ -19,7 +19,7 @@ class HeightenCommand extends ResizeCommand
$this->arguments[2] = function ($constraint) {
$constraint->aspectRatio();
};
return parent::execute($image);
}
}

View File

@@ -13,7 +13,7 @@ class InterlaceCommand extends \Intervention\Image\Commands\AbstractCommand
public function execute($image)
{
$mode = $this->argument(0)->type('bool')->value(true);
imageinterlace($image->getCore(), $mode);
return true;

View File

@@ -38,7 +38,7 @@ class LimitColorsCommand extends \Intervention\Image\Commands\AbstractCommand
// copy original image
imagecopy($resource, $image->getCore(), 0, 0, 0, 0, $size->width, $size->height);
if ($count <= 256) {
// decrease colors
imagetruecolortopalette($resource, true, $count);

View File

@@ -50,11 +50,11 @@ class MaskCommand extends \Intervention\Image\Commands\AbstractCommand
if ($alpha[3] == 0) { // transparent as black
$alpha = 0;
} else {
// $alpha = floatval(round((($alpha[0] + $alpha[1] + $alpha[3]) / 3) / 255, 2));
// image is greyscale, so channel doesn't matter (use red channel)
$alpha = floatval(round($alpha[0] / 255, 2));
$alpha = floatval(round($alpha[0] / 255, 2));
}
}

View File

@@ -22,7 +22,7 @@ class PickColorCommand extends \Intervention\Image\Commands\AbstractCommand
$color = imagecolorat($image->getCore(), $x, $y);
if ( ! imageistruecolor($image->getCore())) {
$color = imagecolorsforindex($image->getCore(), $color);
$color = imagecolorsforindex($image->getCore(), $color);
$color['alpha'] = round(1 - $color['alpha'] / 127, 2);
}

View File

@@ -13,7 +13,7 @@ class ResetCommand extends \Intervention\Image\Commands\AbstractCommand
public function execute($image)
{
if (is_resource($backup = $image->getBackup())) {
// destroy old resource
imagedestroy($image->getCore());
// reset to new resource

View File

@@ -27,7 +27,7 @@ class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand
// check of only width or height is set
$width = is_null($width) ? $original_width : intval($width);
$height = is_null($height) ? $original_height : intval($height);
// check on relative width/height
if ($relative) {
$width = $original_width + $width;
@@ -37,8 +37,8 @@ class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand
// check for negative width/height
$width = ($width <= 0) ? $width + $original_width : $width;
$height = ($height <= 0) ? $height + $original_height : $height;
// create new canvas
// create new canvas
$canvas = $image->getDriver()->newImage($width, $height, $bgcolor);
// set copy position
@@ -60,7 +60,7 @@ class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand
if ($height <= $original_height) {
$dst_y = 0;
$src_y = $canvas_pos->y;
$src_h = $canvas_size->height;
$src_h = $canvas_size->height;
} else {
$dst_y = $image_pos->y;
$src_y = 0;

View File

@@ -109,7 +109,7 @@ class TrimCommand extends ResizeCommand
$checkColor->g = 0;
$checkColor->b = 0;
}
if ($color->differs($checkColor, $tolerance)) {
$top_x = max(0, $x - $feather);
break 2;
@@ -125,7 +125,7 @@ class TrimCommand extends ResizeCommand
for ($y=($height-1); $y >= floor($height/2)-1; $y--) {
for ($x=$top_x; $x < $width; $x++) {
$checkColor = $image->pickColor($x, $y, 'object');
if ($checkTransparency) {
@@ -133,7 +133,7 @@ class TrimCommand extends ResizeCommand
$checkColor->g = 0;
$checkColor->b = 0;
}
if ($color->differs($checkColor, $tolerance)) {
$bottom_y = min($height, $y+1 + $feather);
break 2;
@@ -149,9 +149,9 @@ class TrimCommand extends ResizeCommand
for ($x=($width-1); $x >= floor($width/2)-1; $x--) {
for ($y=$top_y; $y < $bottom_y; $y++) {
$checkColor = $image->pickColor($x, $y, 'object');
if ($checkTransparency) {
$checkColor->r = 0;
$checkColor->g = 0;
@@ -167,7 +167,7 @@ class TrimCommand extends ResizeCommand
}
}
// trim parts of image
return $this->modify($image, 0, 0, $top_x, $top_y, ($bottom_x-$top_x), ($bottom_y-$top_y), ($bottom_x-$top_x), ($bottom_y-$top_y));

View File

@@ -19,7 +19,7 @@ class WidenCommand extends ResizeCommand
$this->arguments[2] = function ($constraint) {
$constraint->aspectRatio();
};
return parent::execute($image);
}
}

View File

@@ -12,8 +12,8 @@ class Driver extends \Intervention\Image\AbstractDriver
* @param Intervention\Image\Gd\Source $source
* @param Intervention\Image\Gd\Encoder $encoder
*/
public function __construct(Source $source = null, Encoder $encoder = null)
{
public function __construct(Source $source = null, Encoder $encoder = null)
{
if ( ! $this->coreAvailable()) {
throw new \Intervention\Image\Exception\NotSupportedException(
"GD Library extension not available with this PHP installation."
@@ -21,8 +21,8 @@ class Driver extends \Intervention\Image\AbstractDriver
}
$this->source = $source ? $source : new Source;
$this->encoder = $encoder ? $encoder : new Encoder;
}
$this->encoder = $encoder ? $encoder : new Encoder;
}
/**
* Creates new image instance

View File

@@ -16,7 +16,7 @@ class Encoder extends \Intervention\Image\AbstractEncoder
$this->image->mime = image_type_to_mime_type(IMAGETYPE_JPEG);
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}

View File

@@ -18,12 +18,12 @@ class CircleShape extends EllipseShape
*
* @param integer $radius
*/
function __construct($radius = null)
public function __construct($radius = null)
{
$this->width = is_numeric($radius) ? intval($radius) : $this->radius;
$this->height = is_numeric($radius) ? intval($radius) : $this->radius;
$this->radius = is_numeric($radius) ? intval($radius) : $this->radius;
}
}
/**
* Draw current circle on given image

View File

@@ -27,7 +27,7 @@ class EllipseShape extends \Intervention\Image\AbstractShape
* @param integer $width
* @param integer $height
*/
function __construct($width = null, $height = null)
public function __construct($width = null, $height = null)
{
$this->width = is_numeric($width) ? intval($width) : $this->width;
$this->height = is_numeric($height) ? intval($height) : $this->height;

View File

@@ -41,7 +41,7 @@ class LineShape extends \Intervention\Image\AbstractShape
* @param integer $x
* @param integer $y
*/
function __construct($x = null, $y = null)
public function __construct($x = null, $y = null)
{
$this->x = is_numeric($x) ? intval($x) : $this->x;
$this->y = is_numeric($y) ? intval($y) : $this->y;

View File

@@ -43,7 +43,7 @@ class RectangleShape extends \Intervention\Image\AbstractShape
* @param integer $x2
* @param integer $y2
*/
function __construct($x1 = null, $y1 = null, $x2 = null, $y2 = null)
public function __construct($x1 = null, $y1 = null, $x2 = null, $y2 = null)
{
$this->x1 = is_numeric($x1) ? intval($x1) : $this->x1;
$this->y1 = is_numeric($y1) ? intval($y1) : $this->y1;

View File

@@ -100,7 +100,7 @@ class ImageManager
$imagecache = new ImageCache($this);
$imagecache = is_callable($callback) ? $callback($imagecache) : $imagecache;
return $imagecache->get($lifetime, $returnObj);
return $imagecache->get($lifetime, $returnObj);
}
throw new \Intervention\Image\Exception\NotSupportedException(

View File

@@ -3,39 +3,39 @@
use Illuminate\Support\ServiceProvider;
use Illuminate\Http\Response;
class ImageServiceProvider extends ServiceProvider {
class ImageServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->package('intervention/image');
}
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->package('intervention/image');
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$app = $this->app;
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$app = $this->app;
$app['image'] = $app->share(function ($app) {
return new ImageManager($app['config']);
});
$app['image'] = $app->share(function ($app) {
return new ImageManager($app['config']);
});
// try to create imagecache route only if imagecache is present
// try to create imagecache route only if imagecache is present
if (class_exists('Intervention\Image\ImageCache')) {
// load imagecache config
@@ -95,16 +95,16 @@ class ImageServiceProvider extends ServiceProvider {
}))->where(array('template' => join('|', array_keys($config->get('imagecache::templates'))), 'filename' => '^[\/\w.-]+$'));
}
}
}
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return array('image');
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return array('image');
}
}

View File

@@ -49,7 +49,7 @@ class Color extends \Intervention\Image\AbstractColor
list($r, $g, $b) = $array;
$a = 1;
}
$this->setPixel($r, $g, $b, $a);
}
@@ -129,9 +129,9 @@ class Color extends \Intervention\Image\AbstractColor
*/
public function getHex($prefix = '')
{
return sprintf('%s%02x%02x%02x', $prefix,
$this->getRedValue(),
$this->getGreenValue(),
return sprintf('%s%02x%02x%02x', $prefix,
$this->getRedValue(),
$this->getGreenValue(),
$this->getBlueValue()
);
}
@@ -158,7 +158,7 @@ class Color extends \Intervention\Image\AbstractColor
*/
public function getRgba()
{
return sprintf('rgba(%d, %d, %d, %.2f)',
return sprintf('rgba(%d, %d, %d, %.2f)',
$this->getRedValue(),
$this->getGreenValue(),
$this->getBlueValue(),

View File

@@ -21,7 +21,7 @@ class FillCommand extends \Intervention\Image\Commands\AbstractCommand
$y = $this->argument(2)->type('integer')->value();
$imagick = $image->getCore();
try {
// set image filling
$source = new Source;
@@ -39,7 +39,7 @@ class FillCommand extends \Intervention\Image\Commands\AbstractCommand
// flood fill with texture
if ($filling instanceof Image) {
// create tile
// create tile
$tile = clone $image->getCore();
// mask away color at position
@@ -50,7 +50,7 @@ class FillCommand extends \Intervention\Image\Commands\AbstractCommand
// fill canvas with texture
$canvas = $canvas->textureImage($filling->getCore());
// merge canvas and tile
$canvas->compositeImage($tile, \Imagick::COMPOSITE_DEFAULT, 0, 0);
@@ -74,8 +74,8 @@ class FillCommand extends \Intervention\Image\Commands\AbstractCommand
$alpha = clone $image->getCore();
// merge original with canvas and tile
$image->getCore()->compositeImage($canvas, \Imagick::COMPOSITE_DEFAULT, 0, 0);
$image->getCore()->compositeImage($tile, \Imagick::COMPOSITE_DEFAULT, 0, 0);
$image->getCore()->compositeImage($canvas, \Imagick::COMPOSITE_DEFAULT, 0, 0);
$image->getCore()->compositeImage($tile, \Imagick::COMPOSITE_DEFAULT, 0, 0);
// restore alpha channel of original image
$image->getCore()->compositeImage($alpha, \Imagick::COMPOSITE_COPYOPACITY, 0, 0);

View File

@@ -22,16 +22,16 @@ class FitCommand extends \Intervention\Image\Commands\AbstractCommand
// crop image
$image->getCore()->cropImage(
$fitted->width,
$fitted->height,
$fitted->pivot->x,
$fitted->width,
$fitted->height,
$fitted->pivot->x,
$fitted->pivot->y
);
// resize image
$image->getCore()->resizeImage($width, $height, \Imagick::FILTER_BOX, 1);
$image->getCore()->setImagePage(0,0,0,0);
return true;
}
}

View File

@@ -17,7 +17,7 @@ class GetSizeCommand extends \Intervention\Image\Commands\AbstractCommand
$info = $image->getCore()->identifyImage(true);
$this->setOutput(new Size(
$info['geometry']['width'],
$info['geometry']['width'],
$info['geometry']['height']
));

View File

@@ -19,7 +19,7 @@ class HeightenCommand extends ResizeCommand
$this->arguments[2] = function ($constraint) {
$constraint->aspectRatio();
};
return parent::execute($image);
}
}

View File

@@ -26,7 +26,7 @@ class LimitColorsCommand extends \Intervention\Image\Commands\AbstractCommand
$alpha->negateImage(false);
if ($matte) {
// get matte color
$mattecolor = $image->getDriver()->parseColor($matte)->getPixel();
@@ -40,18 +40,18 @@ class LimitColorsCommand extends \Intervention\Image\Commands\AbstractCommand
// copy new alpha to canvas
$canvas->compositeImage($alpha, \Imagick::COMPOSITE_COPYOPACITY, 0, 0);
// replace core
$image->setCore($canvas);
} else {
$image->getCore()->quantizeImage($count, \Imagick::COLORSPACE_RGB, 0, false, false);
$image->getCore()->compositeImage($alpha, \Imagick::COMPOSITE_COPYOPACITY, 0, 0);
}
return true;
}
}

View File

@@ -27,7 +27,7 @@ class MaskCommand extends \Intervention\Image\Commands\AbstractCommand
$mask->resize($image_size->width, $image_size->height);
}
$imagick->setImageMatte(true);
$imagick->setImageMatte(true);
if ($mask_w_alpha) {
@@ -35,7 +35,7 @@ class MaskCommand extends \Intervention\Image\Commands\AbstractCommand
$imagick->compositeImage($mask->getCore(), \Imagick::COMPOSITE_DSTIN, 0, 0);
} else {
// get alpha channel of original as greyscale image
$original_alpha = clone $imagick;
$original_alpha->separateImageChannel(\Imagick::CHANNEL_ALPHA);
@@ -48,11 +48,11 @@ class MaskCommand extends \Intervention\Image\Commands\AbstractCommand
// combine both alphas from original and mask
$original_alpha->compositeImage($mask_alpha, \Imagick::COMPOSITE_COPYOPACITY, 0, 0);
// mask the image with the alpha combination
$imagick->compositeImage($original_alpha, \Imagick::COMPOSITE_DSTIN, 0, 0);
}
return true;
return true;
}
}

View File

@@ -15,7 +15,7 @@ class ResetCommand extends \Intervention\Image\Commands\AbstractCommand
$backup = $image->getBackup();
if ($backup instanceof \Imagick) {
// destroy old core
$image->getCore()->clear();

View File

@@ -24,7 +24,7 @@ class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand
// check of only width or height is set
$width = is_null($width) ? $original_width : intval($width);
$height = is_null($height) ? $original_height : intval($height);
// check on relative width/height
if ($relative) {
$width = $original_width + $width;
@@ -34,8 +34,8 @@ class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand
// check for negative width/height
$width = ($width <= 0) ? $width + $original_width : $width;
$height = ($height <= 0) ? $height + $original_height : $height;
// create new canvas
// create new canvas
$canvas = $image->getDriver()->newImage($width, $height, $bgcolor);
// set copy position
@@ -43,7 +43,7 @@ class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand
$image_size = $image->getSize()->align($anchor);
$canvas_pos = $image_size->relativePosition($canvas_size);
$image_pos = $canvas_size->relativePosition($image_size);
if ($width <= $original_width) {
$dst_x = 0;
$src_x = $canvas_pos->x;
@@ -57,7 +57,7 @@ class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand
if ($height <= $original_height) {
$dst_y = 0;
$src_y = $canvas_pos->y;
$src_h = $canvas_size->height;
$src_h = $canvas_size->height;
} else {
$dst_y = $image_pos->y;
$src_y = 0;

View File

@@ -19,7 +19,7 @@ class WidenCommand extends ResizeCommand
$this->arguments[2] = function ($constraint) {
$constraint->aspectRatio();
};
return parent::execute($image);
}
}

View File

@@ -12,8 +12,8 @@ class Driver extends \Intervention\Image\AbstractDriver
* @param Intervention\Image\Imagick\Source $source
* @param Intervention\Image\Imagick\Encoder $encoder
*/
public function __construct(Source $source = null, Encoder $encoder = null)
{
public function __construct(Source $source = null, Encoder $encoder = null)
{
if ( ! $this->coreAvailable()) {
throw new \Intervention\Image\Exception\NotSupportedException(
"ImageMagick module not available with this PHP installation."
@@ -21,8 +21,8 @@ class Driver extends \Intervention\Image\AbstractDriver
}
$this->source = $source ? $source : new Source;
$this->encoder = $encoder ? $encoder : new Encoder;
}
$this->encoder = $encoder ? $encoder : new Encoder;
}
/**
* Creates new image instance

View File

@@ -13,7 +13,7 @@ class Encoder extends \Intervention\Image\AbstractEncoder
{
$format = 'jpeg';
$compression = \Imagick::COMPRESSION_JPEG;
$imagick = $this->image->getCore();
$imagick->setFormat($format);
$imagick->setImageFormat($format);

View File

@@ -72,13 +72,13 @@ class Font extends \Intervention\Image\AbstractFont
// set font file
if ($this->hasApplicableFontFile()) {
$draw->setFont($this->file);
$draw->setFont($this->file);
} else {
throw new \Intervention\Image\Exception\RuntimeException(
"Font file must be provided to apply text to image."
);
}
// parse text color
$color = new Color($this->color);
@@ -94,7 +94,7 @@ class Font extends \Intervention\Image\AbstractFont
case 'right':
$align = \Imagick::ALIGN_RIGHT;
break;
default:
$align = \Imagick::ALIGN_LEFT;
break;

View File

@@ -18,12 +18,12 @@ class CircleShape extends EllipseShape
*
* @param integer $radius
*/
function __construct($radius = null)
public function __construct($radius = null)
{
$this->width = is_numeric($radius) ? intval($radius) : $this->radius;
$this->height = is_numeric($radius) ? intval($radius) : $this->radius;
$this->radius = is_numeric($radius) ? intval($radius) : $this->radius;
}
}
/**
* Draw current circle on given image

View File

@@ -27,11 +27,11 @@ class EllipseShape extends \Intervention\Image\AbstractShape
* @param integer $width
* @param integer $height
*/
function __construct($width = null, $height = null)
public function __construct($width = null, $height = null)
{
$this->width = is_numeric($width) ? intval($width) : $this->width;
$this->height = is_numeric($height) ? intval($height) : $this->height;
}
}
/**
* Draw ellipse instance on given image
@@ -47,7 +47,7 @@ class EllipseShape extends \Intervention\Image\AbstractShape
// set background
$bgcolor = new Color($this->background);
$circle->setFillColor($bgcolor->getPixel());
$circle->setFillColor($bgcolor->getPixel());
// set border
if ($this->hasBorder()) {
@@ -56,7 +56,7 @@ class EllipseShape extends \Intervention\Image\AbstractShape
$circle->setStrokeColor($border_color->getPixel());
}
$circle->ellipse($x, $y, $this->width / 2, $this->height / 2, 0, 360);
$circle->ellipse($x, $y, $this->width / 2, $this->height / 2, 0, 360);
$image->getCore()->drawImage($circle);

View File

@@ -41,7 +41,7 @@ class LineShape extends \Intervention\Image\AbstractShape
* @param integer $x
* @param integer $y
*/
function __construct($x = null, $y = null)
public function __construct($x = null, $y = null)
{
$this->x = is_numeric($x) ? intval($x) : $this->x;
$this->y = is_numeric($y) ? intval($y) : $this->y;

View File

@@ -43,13 +43,13 @@ class RectangleShape extends \Intervention\Image\AbstractShape
* @param integer $x2
* @param integer $y2
*/
function __construct($x1 = null, $y1 = null, $x2 = null, $y2 = null)
public function __construct($x1 = null, $y1 = null, $x2 = null, $y2 = null)
{
$this->x1 = is_numeric($x1) ? intval($x1) : $this->x1;
$this->y1 = is_numeric($y1) ? intval($y1) : $this->y1;
$this->x2 = is_numeric($x2) ? intval($x2) : $this->x2;
$this->y2 = is_numeric($y2) ? intval($y2) : $this->y2;
}
}
/**
* Draw rectangle to given image at certain position
@@ -65,7 +65,7 @@ class RectangleShape extends \Intervention\Image\AbstractShape
// set background
$bgcolor = new Color($this->background);
$rectangle->setFillColor($bgcolor->getPixel());
$rectangle->setFillColor($bgcolor->getPixel());
// set border
if ($this->hasBorder()) {
@@ -74,7 +74,7 @@ class RectangleShape extends \Intervention\Image\AbstractShape
$rectangle->setStrokeColor($border_color->getPixel());
}
$rectangle->rectangle($this->x1, $this->y1, $this->x2, $this->y2);
$rectangle->rectangle($this->x1, $this->y1, $this->x2, $this->y2);
$image->getCore()->drawImage($rectangle);

View File

@@ -70,7 +70,7 @@ class Source extends \Intervention\Image\AbstractSource
$core = new \Imagick;
try {
$core->readImageBlob($binary);
} catch (\ImagickException $e) {

View File

@@ -24,7 +24,7 @@ class Point
* @param integer $x
* @param integer $y
*/
public function __construct($x = null, $y = null)
public function __construct($x = null, $y = null)
{
$this->x = is_numeric($x) ? intval($x) : 0;
$this->y = is_numeric($y) ? intval($y) : 0;

View File

@@ -32,7 +32,7 @@ class Response
* @param string $format
* @param integer $quality
*/
public function __construct(Image $image, $format = null, $quality = null)
public function __construct(Image $image, $format = null, $quality = null)
{
$this->image = $image;
$this->format = $format ? $format : $image->mime;
@@ -51,12 +51,12 @@ class Response
$mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $data);
if (function_exists('app') && is_a($app = app(), 'Illuminate\Foundation\Application')) {
$response = \Response::make($data);
$response->header('Content-Type', $mime);
} else {
header('Content-Type: ' . $mime);
$response = $data;
}

View File

@@ -123,7 +123,7 @@ class Size
} else {
$this->height = $height;
}
if ($constraint->isFixed(Constraint::ASPECTRATIO)) {
$w = intval(round($this->height * $constraint->getSize()->getRatio()));
@@ -142,7 +142,7 @@ class Size
} else {
$this->width = $width;
}
if ($constraint->isFixed(Constraint::ASPECTRATIO)) {
$h = intval(round($this->width / $constraint->getSize()->getRatio()));
@@ -182,18 +182,18 @@ class Size
{
// create size with auto height
$auto_height = clone $size;
$auto_height->resize($this->width, null, function ($constraint) {
$constraint->aspectRatio();
});
// decide which version to use
if ($auto_height->fitsInto($this)) {
$size = $auto_height;
} else {
// create size with auto width
$auto_width = clone $size;