@@ -92,28 +92,28 @@ class Image
9292 use Nette \SmartObject;
9393
9494 /** {@link resize()} only shrinks images */
95- const SHRINK_ONLY = 0b0001 ;
95+ public const SHRINK_ONLY = 0b0001 ;
9696
9797 /** {@link resize()} will ignore aspect ratio */
98- const STRETCH = 0b0010 ;
98+ public const STRETCH = 0b0010 ;
9999
100100 /** {@link resize()} fits in given area so its dimensions are less than or equal to the required dimensions */
101- const FIT = 0b0000 ;
101+ public const FIT = 0b0000 ;
102102
103103 /** {@link resize()} fills given area so its dimensions are greater than or equal to the required dimensions */
104- const FILL = 0b0100 ;
104+ public const FILL = 0b0100 ;
105105
106106 /** {@link resize()} fills given area exactly */
107- const EXACT = 0b1000 ;
107+ public const EXACT = 0b1000 ;
108108
109109 /** image types */
110- const
110+ public const
111111 JPEG = IMAGETYPE_JPEG ,
112112 PNG = IMAGETYPE_PNG ,
113113 GIF = IMAGETYPE_GIF ,
114114 WEBP = 18 ; // IMAGETYPE_WEBP is available as of PHP 7.1
115115
116- const EMPTY_GIF = "GIF89a \x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00! \xf9\x04\x01\x00\x00\x00\x00, \x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D \x01\x00; " ;
116+ public const EMPTY_GIF = "GIF89a \x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00! \xf9\x04\x01\x00\x00\x00\x00, \x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D \x01\x00; " ;
117117
118118 private static $ formats = [self ::JPEG => 'jpeg ' , self ::PNG => 'png ' , self ::GIF => 'gif ' , self ::WEBP => 'webp ' ];
119119
@@ -272,7 +272,7 @@ public function resize($width, $height, int $flags = self::FIT)
272272 return $ this ->resize ($ width , $ height , self ::FILL )->crop ('50% ' , '50% ' , $ width , $ height );
273273 }
274274
275- list ( $ newWidth , $ newHeight) = static ::calculateSize ($ this ->getWidth (), $ this ->getHeight (), $ width , $ height , $ flags );
275+ [ $ newWidth , $ newHeight] = static ::calculateSize ($ this ->getWidth (), $ this ->getHeight (), $ width , $ height , $ flags );
276276
277277 if ($ newWidth !== $ this ->getWidth () || $ newHeight !== $ this ->getHeight ()) { // resize
278278 $ newImage = static ::fromBlank ($ newWidth , $ newHeight , self ::RGB (0 , 0 , 0 , 127 ))->getImageResource ();
@@ -363,7 +363,7 @@ public static function calculateSize(int $srcWidth, int $srcHeight, $newWidth, $
363363 */
364364 public function crop ($ left , $ top , $ width , $ height )
365365 {
366- list ( $ r ['x ' ], $ r ['y ' ], $ r ['width ' ], $ r ['height ' ])
366+ [ $ r ['x ' ], $ r ['y ' ], $ r ['width ' ], $ r ['height ' ]]
367367 = static ::calculateCutout ($ this ->getWidth (), $ this ->getHeight (), $ left , $ top , $ width , $ height );
368368 $ this ->image = imagecrop ($ this ->image , $ r );
369369 return $ this ;
0 commit comments