Page 1 of 1

PHP Warning: imagecopyresampled()

Posted: Fri Feb 22, 2013 8:53 am
by madfish
Hello,

my server crashes all of sudden with this error : Warning: mysql_connect(): Too many connections in /home/profumino/public_html/system/database/mysql.php on line 6 Error: Could not make a database connection using root@localhost Warning: mysql_close() expects parameter 1 to be resource, boolean given in /home/profumino/public_html/system/database/mysql.php on line 67

In the opencart log i find this (the error comes every 30seconds ) :


2013-02-22 1:15:24 - PHP Warning: imagecopyresampled() expects parameter 2 to be resource, null given in /home/profumino/public_html/system/library/image.php on line 87
2013-02-22 1:15:24 - PHP Warning: imagedestroy() expects parameter 1 to be resource, null given in /home/profumino/public_html/system/library/image.php on line 88
2013-02-22 1:15:53 - PHP Warning: imagecopyresampled() expects parameter 2 to be resource, null given in /home/profumino/public_html/system/library/image.php on line 87
2013-02-22 1:15:53 - PHP Warning: imagedestroy() expects parameter 1 to be resource, null given in /home/profumino/public_html/system/library/image.php on line 88
2013-02-22 1:16:10 - PHP Warning: imagecopyresampled() expects parameter 2 to be resource, null given in /home/profumino/public_html/system/library/image.php on line 87
2013-02-22 1:16:10 - PHP Warning: imagedestroy() expects parameter 1 to be resource, null given in /home/profumino/public_html/system/library/image.php on line 88
2013-02-22 1:16:10 - PHP Warning: imagecopyresampled() expects parameter 2 to be resource, null given in /home/profumino/public_html/system/library/image.php on line 87
2013-02-22 1:16:10 - PHP Warning: imagedestroy() expects parameter 1 to be resource, null given in /home/profumino/public_html/system/library/image.php on line 88
2013-02-22 1:16:24 - PHP Warning: imagecopyresampled() expects parameter 2 to be resource, null given in /home/profumino/public_html/system/library/image.php on line 87
2013-02-22 1:16:24 - PHP Warning: imagedestroy() expects parameter 1 to be resource, null given in /home/profumino/public_html/system/library/image.php on line 88
2013-02-22 1:16:56 - PHP Warning: imagecopyresampled() expects parameter 2 to be resource, null given in /home/profumino/public_html/system/library/image.php on line 87
2013-02-22 1:16:56 - PHP Warning: imagedestroy() expects parameter 1 to be resource, null given in /home/profumino/public_html/system/library/image.php on line 88
2013-02-22 1:17:20 - PHP Warning: imagecopyresampled() expects parameter 2 to be resource, null given in /home/profumino/public_html/system/library/image.php on line 87
2013-02-22 1:17:20 - PHP Warning: imagedestroy() expects parameter 1 to be resource, null given in /home/profumino/public_html/system/library/image.php on line 88



What should I do ??? Thank you.

Re: PHP Warning: imagecopyresampled()

Posted: Fri Feb 22, 2013 9:19 am
by JAY6390
They are two unrelated issues, though the second may inadvertently be caused by the first. The first is pretty simple. Your server can't handle the number of requests to MYSQL meaning your database is overloaded with connections. If you're on a shared server this is pretty common. The second error is because your image likely doesn't exist, possibly because the image name can't be retrieved from the database as a result of the mysql error

Re: PHP Warning: imagecopyresampled()

Posted: Fri Feb 22, 2013 9:30 am
by madfish
Thank your for your answer. Well I dont use a shared server, but a VPS.

Yes I understand, but the problem started 3 hours ago, until than it worked fine. Is there anyone able to take a look ? I will pay for the service of course.

Re: PHP Warning: imagecopyresampled()

Posted: Fri Feb 22, 2013 9:36 am
by JAY6390
It appears your traffic is causing the mysql error and there's little other than configuration or a better server that will accomodate this. If you have a host that offers tech support, I would recommend you contact them first to see if they can fix the issue as it may even be a problem with the server

Re: PHP Warning: imagecopyresampled()

Posted: Thu Apr 04, 2013 6:57 pm
by cheepnis
I've been getting a lot of the second errors, but no issues with mysql. This seems to be during an image resize function, based upon the code that triggers it. Any ideas?

PHP Warning: imagecopyresampled() expects parameter 2 to be resource, null given in /home/renamed/public_html/store/system/library/image.php on line 109
PHP Warning: imagedestroy() expects parameter 1 to be resource, null given in /home/renamed/public_html/store/system/library/image.php on line 110

Re: PHP Warning: imagecopyresampled()

Posted: Sat May 04, 2013 9:44 am
by cheepnis
I think I found the problem. This function cannot handle BMG image files. File was converted to jpg and the problem seems to have gone away. 8)

Re: PHP Warning: imagecopyresampled()

Posted: Sun Oct 06, 2013 4:51 pm
by Thales3
I get the same errors :
...PHP Warning: imagecopyresampled() expects parameter 1 to be resource, null given in...
...PHP Warning: imagecopyresampled() expects parameter 2 to be resource, null given in...
but i don't have any file with BMP extension.
Any ideea how to solve this ?

Re: PHP Warning: imagecopyresampled()

Posted: Mon Oct 07, 2013 1:33 pm
by butte
You can check images' integrities locally before sending them up (initially or after testing) by using badpeggy (http://download.cnet.com/Bad-Peggy/3000 ... 91203.html and https://github.com/coderslagoon/BadPeggy among others). It was useful in reviewing images in context of a bad feed at http://forum.opencart.com/viewtopic.php ... 18#p439018 .

Re: PHP Warning: imagecopyresampled()

Posted: Fri Jul 24, 2015 6:01 pm
by khantisari
yes, this thread help me.. and the bmpg file is the trouble.. and delete it.. everything is fine

Re: PHP Warning: imagecopyresampled()

Posted: Sun Oct 02, 2016 7:47 am
by techpertz
Same Issue...
Warning: imagecopyresampled() expects parameter 2 to be resource, null given in /home/kondlibazar121/public_html/system/library/image.php on line 118Warning: imagedestroy() expects parameter 1 to be resource, null given in /home/kondlibazar121/public_html/system/library/image.php on line 119

and one more thing
When I add an image while adding product from admin then the image is not visible on image popup window but it shows link just like visible image and is being selected on clicking on it, now there on main window of product adding (Data tab) it is not visible. And It's not visible on Store as well.

Screenshots are attached.

FYI: I switched my website from a Hostingraja's server to GoDaddy's VPS
It was working fine on old server

OC Version 2.1.0.1

It seems that I have to go to old server. GoDaddy's Team (Indian Team) is a worst tech team. They just ask to upgrade the package instead of sorting the issue. Well it's long story... :(

Please HELP

Thanks