I spent some hours struggling with figuring out why images on my local copy of a live Opencart site were not being displayed. Opencart seemed to not generate the resized product images and store them in the cache folder.
After a long search, I found the answer. Images were not being generated because I had PHP8 installed locally, and in PHP8, the GD library uses a class object instead of a resource. Opencart was checking for a resource using is_resource()
The solution was simple; also check for class objects.
In system/library/image.php
, replace
if (is_resource($this->image)) {
with
if (is_resource($this->image) || is_object($this->image)) {
Top comments (0)