mirror of
https://github.com/Intervention/image.git
synced 2025-01-17 20:28:21 +01:00
psr fixes
This commit is contained in:
parent
889b0343ba
commit
bf91911649
@ -47,7 +47,7 @@ class Font
|
|||||||
private $valign;
|
private $valign;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Path to TTF or GD library internal font file of the text
|
* Path to TTF or GD library internal font file of the text
|
||||||
*
|
*
|
||||||
* @var mixed
|
* @var mixed
|
||||||
*/
|
*/
|
||||||
@ -58,7 +58,7 @@ class Font
|
|||||||
*
|
*
|
||||||
* @param Strinf $text Text to be written
|
* @param Strinf $text Text to be written
|
||||||
*/
|
*/
|
||||||
public function __construct($text = null)
|
public function __construct($text = null)
|
||||||
{
|
{
|
||||||
$this->text = $text;
|
$this->text = $text;
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ class Font
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get rotation angle of text
|
* Get rotation angle of text
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getAngle()
|
public function getAngle()
|
||||||
@ -219,7 +219,7 @@ class Font
|
|||||||
{
|
{
|
||||||
return $this->file;
|
return $this->file;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if current font has access to an applicable font file
|
* Checks if current font has access to an applicable font file
|
||||||
*
|
*
|
||||||
@ -353,7 +353,7 @@ class Font
|
|||||||
if ($this->angle != 0 || is_string($this->align) || is_string($this->valign)) {
|
if ($this->angle != 0 || is_string($this->align) || is_string($this->valign)) {
|
||||||
|
|
||||||
$box = $this->getBoxSize();
|
$box = $this->getBoxSize();
|
||||||
|
|
||||||
$align = is_null($this->align) ? 'left' : strtolower($this->align);
|
$align = is_null($this->align) ? 'left' : strtolower($this->align);
|
||||||
$valign = is_null($this->valign) ? 'bottom' : strtolower($this->valign);
|
$valign = is_null($this->valign) ? 'bottom' : strtolower($this->valign);
|
||||||
|
|
||||||
@ -409,11 +409,11 @@ class Font
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// $image->rectangle(array(0,0,0,0.5), $posx+$box[6], $posy+$box[7], $posx+$box[2], $posy+$box[3]);
|
// $image->rectangle(array(0,0,0,0.5), $posx+$box[6], $posy+$box[7], $posx+$box[2], $posy+$box[3]);
|
||||||
|
|
||||||
// enable alphablending for imagettftext
|
// enable alphablending for imagettftext
|
||||||
imagealphablending($image->resource, true);
|
imagealphablending($image->resource, true);
|
||||||
|
|
||||||
// draw ttf text
|
// draw ttf text
|
||||||
imagettftext($image->resource, $this->getPointSize(), $this->angle, $posx, $posy, $color, $this->file, $this->text);
|
imagettftext($image->resource, $this->getPointSize(), $this->angle, $posx, $posy, $color, $this->file, $this->text);
|
||||||
@ -436,7 +436,7 @@ class Font
|
|||||||
$top_correction = 3;
|
$top_correction = 3;
|
||||||
$bottom_correction = 4;
|
$bottom_correction = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// x-position corrections for horizontal alignment
|
// x-position corrections for horizontal alignment
|
||||||
switch (strtolower($this->align)) {
|
switch (strtolower($this->align)) {
|
||||||
case 'center':
|
case 'center':
|
||||||
@ -465,7 +465,7 @@ class Font
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw text
|
// draw text
|
||||||
imagestring($image->resource, $this->getInternalFont(), $posx, $posy, $this->text, $color);
|
imagestring($image->resource, $this->getInternalFont(), $posx, $posy, $this->text, $color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -785,7 +785,7 @@ class Image
|
|||||||
$color = imagecolorsforindex($this->resource, imagecolorat($this->resource, $base_x, $base_y));
|
$color = imagecolorsforindex($this->resource, imagecolorat($this->resource, $base_x, $base_y));
|
||||||
|
|
||||||
// compare colors
|
// compare colors
|
||||||
$colorDiffers = function($c1, $c2) use ($checkTransparency, $color_tolerance, $alpha_tolerance) {
|
$colorDiffers = function ($c1, $c2) use ($checkTransparency, $color_tolerance, $alpha_tolerance) {
|
||||||
|
|
||||||
if ($checkTransparency == true) {
|
if ($checkTransparency == true) {
|
||||||
|
|
||||||
@ -798,11 +798,11 @@ class Image
|
|||||||
$green_delta = abs($c1['green'] - $c2['green']);
|
$green_delta = abs($c1['green'] - $c2['green']);
|
||||||
$blue_delta = abs($c1['blue'] - $c2['blue']);
|
$blue_delta = abs($c1['blue'] - $c2['blue']);
|
||||||
$alpha_delta = abs($c1['alpha'] - $c2['alpha']);
|
$alpha_delta = abs($c1['alpha'] - $c2['alpha']);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
$red_delta > $color_tolerance or
|
$red_delta > $color_tolerance or
|
||||||
$green_delta > $color_tolerance or
|
$green_delta > $color_tolerance or
|
||||||
$blue_delta > $color_tolerance or
|
$blue_delta > $color_tolerance or
|
||||||
$alpha_delta > $alpha_tolerance
|
$alpha_delta > $alpha_tolerance
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ class ImageServiceProvider extends ServiceProvider
|
|||||||
$config['templates']['original'] = null;
|
$config['templates']['original'] = null;
|
||||||
|
|
||||||
// setup image manipulator route
|
// setup image manipulator route
|
||||||
$this->app['router']->get($config['route'].'/{template}/{filename}', array('as' => 'imagecache', function($template, $filename) use ($config) {
|
$this->app['router']->get($config['route'].'/{template}/{filename}', array('as' => 'imagecache', function ($template, $filename) use ($config) {
|
||||||
|
|
||||||
// find file
|
// find file
|
||||||
foreach ($config['paths'] as $path) {
|
foreach ($config['paths'] as $path) {
|
||||||
@ -74,7 +74,7 @@ class ImageServiceProvider extends ServiceProvider
|
|||||||
if (is_callable($callback)) {
|
if (is_callable($callback)) {
|
||||||
|
|
||||||
// image manipulation based on callback
|
// image manipulation based on callback
|
||||||
$content = $this->app['image']->cache(function($image) use ($image_path, $callback) {
|
$content = $this->app['image']->cache(function ($image) use ($image_path, $callback) {
|
||||||
return $callback($image->make($image_path));
|
return $callback($image->make($image_path));
|
||||||
}, $config['lifetime']);
|
}, $config['lifetime']);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user