Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
+8
-8
@@ -11,7 +11,7 @@
|
||||
namespace IPS\Image;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -47,9 +47,9 @@ class _Gd extends \IPS\Image
|
||||
$this->image = @imagecreatefromstring( $contents );
|
||||
if ( $this->image === FALSE )
|
||||
{
|
||||
if ( $error = error_get_last() )
|
||||
if ( $error = \IPS\IPS::$lastError )
|
||||
{
|
||||
throw new \InvalidArgumentException( $error['message'], $error['type'] );
|
||||
throw new \InvalidArgumentException( $error->getMessage(), $error->getCode() );
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException;
|
||||
@@ -98,8 +98,8 @@ class _Gd extends \IPS\Image
|
||||
$fontColor = imagecolorallocate( $this->image, 255, 255, 255 );
|
||||
|
||||
$box = imagettfbbox( $size, 0, $font, $text );
|
||||
$x = intval( ( imagesx( $this->image ) - abs( max( $box[2], $box[4] ) ) ) / 2 ) - ( ( $box[0] > 0 ) ? ( $box[0] / 2.5 ) : 0 );
|
||||
$y = intval( ( imagesy( $this->image ) + ( abs( $box[5] ) - abs( $box[1] ) ) ) / 2 );
|
||||
$x = \intval( ( imagesx( $this->image ) - abs( max( $box[2], $box[4] ) ) ) / 2 ) - ( ( $box[0] > 0 ) ? ( $box[0] / 2.5 ) : 0 );
|
||||
$y = \intval( ( imagesy( $this->image ) + ( abs( $box[5] ) - abs( $box[1] ) ) ) / 2 );
|
||||
|
||||
imagettftext( $this->image, $size, 0, $x, $y, $fontColor, $font, $text );
|
||||
}
|
||||
@@ -111,7 +111,7 @@ class _Gd extends \IPS\Image
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
if( is_resource( $this->image ) )
|
||||
if( \is_resource( $this->image ) )
|
||||
{
|
||||
imagedestroy( $this->image );
|
||||
}
|
||||
@@ -322,7 +322,7 @@ class _Gd extends \IPS\Image
|
||||
*
|
||||
* @param \IPS\Image $image Image to impose
|
||||
* @param int $x Location to impose to, x axis
|
||||
* @param int y Location to impose to, y axis
|
||||
* @param int $y Location to impose to, y axis
|
||||
* @return void
|
||||
*/
|
||||
public function impose( $image, $x=0, $y=0 )
|
||||
@@ -388,6 +388,6 @@ class _Gd extends \IPS\Image
|
||||
*/
|
||||
public static function canWriteText()
|
||||
{
|
||||
return (bool) function_exists( 'imagettfbbox' );
|
||||
return (bool) \function_exists( 'imagettfbbox' );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user