Page 1 of 1

PHP Warning: imagecopyresampled() expects parameter 1 to be resource, bool given

Posted: Tue Jan 18, 2022 10:30 am
by Majnoon
Hello every one,
I am seeing PHP warnings in my opencart admin error_log. Opencart version is 3.0.3.5 default theme . Php version is 7.3

PHP Warning:

Code: Select all

PHP Warning: imagecopyresampled() expects parameter 1 to be resource, bool given in /home/xxx/public_html/xyz/system/library/image.php on line 182
the code on the line is:

Code: Select all

imagecopyresampled($this->image, $image_old, $xpos, $ypos, 0, 0, $new_width, $new_height, $this->width, $this->height);
PHP Warning:

Code: Select all

PHP Warning: imagecolorallocate() expects parameter 1 to be resource, bool given in /home/xxx/public_html/xyz/system/library/image.php on line 177
the code on the line is:

Code: Select all

$background = imagecolorallocate($this->image, 255, 255, 255);
PHP Warning:

Code: Select all

PHP Warning: imagefilledrectangle() expects parameter 1 to be resource, bool given in /home/xxx/public_html/xyz/system/library/image.php on line 180
the code on the line is:

Code: Select all

imagefilledrectangle($this->image, 0, 0, $width, $height, $background);
PHP Warning:

Code: Select all

PHP Warning: imagecreatetruecolor(): Invalid image dimensions in /home/xxx/public_html/xyz/system/library/image.php on line 169
the code on the line is:

Code: Select all

$this->image = imagecreatetruecolor($width, $height);
Any help is much appreciated.

Re: PHP Warning: imagecopyresampled() expects parameter 1 to be resource, bool given

Posted: Tue Jan 18, 2022 11:20 am
by by mona
Do you have image sizes in all of your extension => themes image sizes section ?

Re: PHP Warning: imagecopyresampled() expects parameter 1 to be resource, bool given

Posted: Tue Jan 18, 2022 3:18 pm
by Majnoon
by mona wrote:
Tue Jan 18, 2022 11:20 am
Do you have image sizes in all of your extension => themes image sizes section ?
If i am not mistaken yes. Does it has to do with some image or heights somewhere? Because this waring doesn't appear every day but once in a while.
So if i follow your line this means there is some page which has the image without size into it ???

Re: PHP Warning: imagecopyresampled() expects parameter 1 to be resource, bool given

Posted: Wed Jan 19, 2022 7:11 am
by by mona
You can check if you go to EXTENSION = > THEMES .. there is a list
otherwise you are probably looking at an extension error

Re: PHP Warning: imagecopyresampled() expects parameter 1 to be resource, bool given

Posted: Wed Jan 19, 2022 9:15 pm
by paulfeakins
If the above doesn't solve your problem, you could pay a developer such as ourselves or post a job in the Commercial Support Forum.