Skip to content

Commit b3a09c8

Browse files
Chhandak.BaruaChhandak.Barua
Chhandak.Barua
authored and
Chhandak.Barua
committed
ACP2E-3127: imagecreatetruecolor(): Argument #2 () must be greater than 0. Can't upload specific image
1 parent 5c0fc10 commit b3a09c8

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

lib/internal/Magento/Framework/Image/Adapter/AbstractAdapter.php

+10-9
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
/**
1313
* Image abstract adapter
1414
*
15+
* phpcs:disable Magento2.Classes.AbstractApi
1516
* @api
1617
* @SuppressWarnings(PHPMD.TooManyFields)
1718
*/
@@ -27,25 +28,25 @@ abstract class AbstractAdapter implements AdapterInterface
2728
* Position constants.
2829
* Used mainly for watermarks
2930
*/
30-
const POSITION_TOP_LEFT = 'top-left';
31+
public const POSITION_TOP_LEFT = 'top-left';
3132

32-
const POSITION_TOP_RIGHT = 'top-right';
33+
public const POSITION_TOP_RIGHT = 'top-right';
3334

34-
const POSITION_BOTTOM_LEFT = 'bottom-left';
35+
public const POSITION_BOTTOM_LEFT = 'bottom-left';
3536

36-
const POSITION_BOTTOM_RIGHT = 'bottom-right';
37+
public const POSITION_BOTTOM_RIGHT = 'bottom-right';
3738

38-
const POSITION_STRETCH = 'stretch';
39+
public const POSITION_STRETCH = 'stretch';
3940

40-
const POSITION_TILE = 'tile';
41+
public const POSITION_TILE = 'tile';
4142

42-
const POSITION_CENTER = 'center';
43+
public const POSITION_CENTER = 'center';
4344
/**#@-*/
4445

4546
/**
4647
* The size of the font to use as default
4748
*/
48-
const DEFAULT_FONT_SIZE = 15;
49+
public const DEFAULT_FONT_SIZE = 15;
4950

5051
/**
5152
* @var int
@@ -627,7 +628,7 @@ protected function _checkDimensions($frameWidth, $frameHeight)
627628
{
628629
if ($frameWidth !== null && $frameWidth <= 0 ||
629630
$frameHeight !== null && $frameHeight <= 0 ||
630-
empty($frameWidth) && empty($frameHeight)
631+
($frameWidth === '' && $frameHeight === '')
631632
) {
632633
//phpcs:ignore Magento2.Exceptions.DirectThrow
633634
throw new \InvalidArgumentException('Invalid image dimensions.');

0 commit comments

Comments
 (0)