Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2018
    Location
    Durban, South Africa
    Posts
    5
    Plugin Contributions
    0

    Default PHP 8.0.0 to PHP 8.0.25 - Object of class GdImage could not be converted to string

    Zen Cart 1.5.7c
    Database Patch Level: 1.5.7c
    PHP Version: 8.0.25 (Zend: 4.0.25)
    Server OS: Linux 4.18.0-372.32.1.lve.el8.x86_6

    The PHP version on our shared server was upgrade from PHP 8.0.0 to PHP 8.0.25. I added a new product to my catalogue on the back-end, but when I try to open the new category on the front-end I get this error message in the logs:

    PHP Fatal error: Uncaught Error: Object of class GdImage could not be converted to string in /home/ccfsecur/domains/ccfsecuritysystems.co.za/public_html/includes/classes/bmz_image_handler.class.php:851

    Code:
    protected function save_imageGD($file_ext, $image, $dest_name, $quality = 75) 
        {
            // -----
            // Initially, santitize the quality input for use by imagejpeg; values should
            // be in the range 0-100.
            //
            $quality = (int)$quality;
            if ($quality < 0 || $quality > 100) {
                $quality = 75;
            }
            $this->ihLog("save_imageGD($file_ext, $image, $dest_name, $quality)");
            switch (strtolower($file_ext)) {
                case '.gif':
                    if (!function_exists('imagegif')) {
                        $this->ihLog("save_imageGD, imagegif function does not exist");
                        return false;
                    }
                    $ok = imagegif($image, $dest_name);
                    break;
                case '.png':
                    if (!function_exists("imagepng")) {
                        $this->ihLog("save_imageGD, imagepng function does not exist");
                        return false;
                    }
                    
                    // -----
                    // The quality input for imagepng requires an integer value in the
                    // range 0-9.  If the value's out-of-range, use a proportional setting
                    // based on the input.
                    //
                    if ($quality > 9) {
                        $quality = (int)(9 * $quality / 100);
                    }
                    $ok = imagepng($image, $dest_name, $quality);
                    break;
                case '.jpg':
                case '.jpeg':
                    if (!function_exists("imagejpeg")) {
                        $this->ihLog("save_imageGD, imagejpeg function does not exist");
                        return false;
                    }
                    $ok = imagejpeg($image, $dest_name, $quality);
                    break;
                default: 
                    $ok = false;
                    break;
            }
            imagedestroy($image);
        
            return $ok;
        }
    Line 851 is:
    Code:
    $this->ihLog("save_imageGD($file_ext, $image, $dest_name, $quality)");
    I have just "comment out" line 851 by placing // informt of the code, and it seems to work. Did I do the right thing, or did I break something else?
    I'm new to PHP, any assist will be appreciated.
    Last edited by ChrisFourie; 16 Feb 2023 at 08:46 AM.

  2. #2
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,248
    Plugin Contributions
    1

    Default Re: PHP 8.0.0 to PHP 8.0.25 - Object of class GdImage could not be converted to strin

    Your Image Handler mod needs updating.
    Simon

 

 

Similar Threads

  1. Replies: 6
    Last Post: 13 Jul 2016, 01:05 PM
  2. Replies: 1
    Last Post: 24 Oct 2009, 09:09 PM
  3. Object of class psigate_xml could not be converted to string
    By james739 in forum Addon Payment Modules
    Replies: 3
    Last Post: 19 Jun 2009, 04:20 PM
  4. Coupon Restrict: Object of class queryFactoryResult could not be converted to string
    By DodgeGirl in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 5
    Last Post: 4 Mar 2009, 10:25 AM
  5. Object of class Directory could not be converted to string
    By jeking in forum General Questions
    Replies: 4
    Last Post: 17 Oct 2008, 09:35 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR