If this is your first visit, check our documentation. To post, register or login.
Forums / All Other Contributions/Addons / Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

Started by lat9 on 15 Oct 2017, 3:54 PM · Views: 160,515

Results 501 to 520 of 774
18 Apr 2022, 1:31 AM
#501
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

As per curiosity, it seems that .webp is becoming more and more like suggested by google pagespeed.

Would IH support .webp format eventually? or even .avif

thank you

18 Apr 2022, 7:02 PM
#502
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
Plugin Contributions:
56

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

nicksab:

As per curiosity, it seems that .webp is becoming more and more like suggested by google pagespeed.

Would IH support .webp format eventually? or even .avif

thank you
Probably not, those files are already somewhat compressed and there are no built-in PHP function(s) to handle any re-sizing.

19 Apr 2022, 1:17 PM
#503
shrimp_gumbo_mmmhhh avatar

shrimp_gumbo_mmmhhh

Totally Zenned

Join Date:
Jun 2007
Location:
Texas, USA
Posts:
1,436
Plugin Contributions:
0

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

Hello Lat9! Love the mod. I am starting to add more pictures to products and am noticing that the additional pictures are not being covered by the watermark as well as the regular picture (watermark much smaller). Can this be changed easily? The hover over has great watermarking but the small image without hover does not show the watermarking well.

19 Apr 2022, 1:25 PM
#504
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
Plugin Contributions:
56

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

shrimp-gumbo-mmmhhh:

Hello Lat9! Love the mod. I am starting to add more pictures to products and am noticing that the additional pictures are not being covered by the watermark as well as the regular picture (watermark much smaller). Can this be changed easily? The hover over has great watermarking but the small image without hover does not show the watermarking well.
What dimensions are you using for your small images? Is the dimension of the small-image watermark the same?

31 Jul 2022, 11:49 AM
#505
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
Plugin Contributions:
56

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

I've just submitted v5.3.0 of Image Handler for the Zen Cart moderators' review; I'll post back here when it's available for download.

Note: This version of Image Handler requires Zen Cart 1.5.7 or later and has been tested with the current alpha version of Zen Cart 1.5.8 as well as PHP 8.1.

This release contains changes associated with the following GitHub issues:

#248: Correcting PHP 8.0+ Fatal error; casting requires correction.
#251: Correcting products' dropdown sorting for zc158; always sort by products' names.
#252: Correcting PHP Fatal error: Uncaught TypeError: imagecolorallocatealpha(); inputs need to be integers, not floats.
#254: Move installation files to branch root, removing 'Installation Files' sub-directory.
#256: Drop support for Zen Cart versions prior to 1.5.7.
#258: Properly handle corrupt file.

31 Jul 2022, 6:06 PM
#506
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
Plugin Contributions:
56

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

lat9:

I've just submitted v5.3.0 of Image Handler for the Zen Cart moderators' review; I'll post back here when it's available for download.

Note: This version of Image Handler requires Zen Cart 1.5.7 or later and has been tested with the current alpha version of Zen Cart 1.5.8 as well as PHP 8.1.

This release contains changes associated with the following GitHub issues:

#248: Correcting PHP 8.0+ Fatal error; casting requires correction.
#251: Correcting products' dropdown sorting for zc158; always sort by products' names.
#252: Correcting PHP Fatal error: Uncaught TypeError: imagecolorallocatealpha(); inputs need to be integers, not floats.
#254: Move installation files to branch root, removing 'Installation Files' sub-directory.
#256: Drop support for Zen Cart versions prior to 1.5.7.
#258: Properly handle corrupt file.
Now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2169

27 Oct 2022, 2:05 AM
#507
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

I am getting the following error when IH encounter a .webp file.

[27-Oct-2022 00:18:57 UTC] PHP Notice: Image Handler, calculate_size for /images/90674z_11zon.webp returned false; image is corrupt. in /includes/classes/bmz_image_handler.class.php on line 484

This is just an example as i am getting the same log for several other .webp file.

I tried to clear the cache thru the admin interface but no change. I understand IH is not compatible with .webp but i thought it would ignore it instead of throwing an error.

Thank you

27 Oct 2022, 11:00 AM
#508
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
Plugin Contributions:
56

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

nicksab:

I am getting the following error when IH encounter a .webp file.

This is just an example as i am getting the same log for several other .webp file.

I tried to clear the cache thru the admin interface but no change. I understand IH is not compatible with .webp but i thought it would ignore it instead of throwing an error.

Thank you
I would have thought the same. I'm in the middle of a lot of other stuff right now, but when I get back to IH I will certainly look at this.

27 Oct 2022, 12:09 PM
#509
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
509
Plugin Contributions:
1

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

This is a work around that will allow you to use webp images and not get the error. While lat9 is busy. It is not intended as a final fix.

Modify \includes\classes\observers\ImageHandlerObserver.php

 public function update(&$class, $eventID, $p1, &$p2, &$p3, &$p4, &$p5, &$p6) 
    {
        switch ($eventID) {

to```
public function update(&$class, $eventID, $p1, &$p2, &$p3, &$p4, &$p5, &$p6)
{
if (strtolower(right($p1,-5)) == '.webp') {
return;
}
switch ($eventID) {


This will stop image handler processing your webp images.

Mark Brittain
http:\innerlightcrystals.co.uk\sales\

27 Oct 2022, 12:21 PM
#510
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
509
Plugin Contributions:
1

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

Just found thad does not work if you have multiple images. This does

 public function update(&$class, $eventID, $p1, &$p2, &$p3, &$p4, &$p5, &$p6) 
    {
        if (strtolower($p3) == '.webp') {
            return;
        }
        switch ($eventID) {

Assumes that all images for a product have same extension.

Mark Brittain
http:\innerlightcrystals.co.uk\sales\

27 Oct 2022, 12:48 PM
#511
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
509
Plugin Contributions:
1

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

That was not enough either. I have had to change each notifier. Hence, replace whole of \includes\classes\observers\ImageHandlerObserver.php

with

<?php
// -----
// Part of the "Image Handler" plugin for Zen Cart 1.5.5b and later.
// Copyright (c) 2017-2021 Vinos de Frutas Tropicales
//
if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
}

class ImageHandlerObserver extends base 
{
    public function __construct() 
    {
        if (defined('IH_RESIZE') && IH_RESIZE == 'yes') {
            $this->attach(
                $this,
                [
                    //- From /includes/modules/main_product_image.php
                    'NOTIFY_MODULES_MAIN_PRODUCT_IMAGE_FILENAME',
                    
                    //- From /includes/modules/additional_images.php
                    'NOTIFY_MODULES_ADDITIONAL_IMAGES_GET_LARGE',
                    'NOTIFY_MODULES_ADDITIONAL_IMAGES_THUMB_SLASHES',
                    
                    //- From /includes/pages/popup_image/header_php.php
                    'NOTIFY_HEADER_END_POPUP_IMAGES',
                ]
            );
        }
    }
  
    public function update(&$class, $eventID, $p1, &$p2, &$p3, &$p4, &$p5, &$p6) 
    {
        switch ($eventID) {
            // -----
            // This notifier lets an image-handling observer know that it's time to determine the image information,
            // providing the following parameters:
            //
            // $p1 ... (r/o) ... A copy of the $products_image value
            // $p2 ... (r/w) ... A boolean value, set by the observer to true if the image has been handled.
            // $p3 ... (r/w) ... A reference to the $products_image_extension value
            // $p4 ... (r/w) ... A reference to the $products_image_base value
            // $p5 ... (r/w) ... A reference to the medium product-image-name
            // $p6 ... (r/w) ... A reference to the large product-image-name.
            //
            // If the observer has set the $product_image_handled flag to true, it's indicated that any of the
            // other values have been updated for separate handling.
            //
            case 'NOTIFY_MODULES_MAIN_PRODUCT_IMAGE_FILENAME':
                if (strtolower($p3) == '.webp') {
                    break;
                }
                $products_image = $p1;
                $products_image_extension = $p3;
                $p4 = $products_image_base = preg_replace('/' . $products_image_extension . '$/', '', $products_image);
                $p5 = DIR_WS_IMAGES . 'medium/' . $products_image_base . IMAGE_SUFFIX_MEDIUM . $products_image_extension;
                $p6  = DIR_WS_IMAGES . 'large/' . $products_image_base . IMAGE_SUFFIX_LARGE .  $products_image_extension;
                
                $p2 = true;  //-Indicate that the image has been "handled".
                break;
                
            // -----
            // This notifier lets any image-handler know the current image being processed, providing the following parameters:
            //
            // $p1 ... (r/o) ... The current product's name
            // $p2 ... (r/w) ... The (possibly updated) filename (including path) of the current additional image.
            //
            case 'NOTIFY_MODULES_ADDITIONAL_IMAGES_GET_LARGE':
                if (strtolower(substr($p2,-5)) == '.webp') {
                    break;
                }
                $products_name = $p1;
                $products_image_large = $p2;
                if (function_exists('handle_image')) {
                    $newimg = handle_image($products_image_large, addslashes($products_name), LARGE_IMAGE_MAX_WIDTH, LARGE_IMAGE_MAX_HEIGHT, '');
                    list($src, $alt, $width, $height, $parameters) = $newimg;
                    $p2 = zen_output_string($src);
                } 
                break;
                
            // -----
            // This notifier lets any image-handler "massage" the name of the current thumbnail image name with appropriate
            // slashes for javascript/jQuery display:
            //
            // $p1 ... (n/a) ... An empty array, not applicable.
            // $p2 ... (r/w) ... A reference to the "slashed" thumbnail image name.
            //                
            case 'NOTIFY_MODULES_ADDITIONAL_IMAGES_THUMB_SLASHES':
                //  remove additional single quotes from image attributes (important!)
                if (strtolower(substr($p2,-5)) == '.webp') {
                    break;
                }
                $thumb_slashes = $p2;
                $p2 = preg_replace("/([^\\\\])'/", '$1\\\'', $thumb_slashes);
                break;
            
            // -----
            // Update the (globally-available) image names for any rendering of the popup_image page.
            //
            case 'NOTIFY_HEADER_END_POPUP_IMAGES':
                global $products_image,
                       $products_image_extension, 
                       $products_image_base,
                       $products_image_medium,
                       $products_image_large;
                       
                       if (srttolower($products_image_extension) == '.webp'){
                           break;
                       }
                
                $products_image_base = preg_replace('/' . $products_image_extension . '$/', '', $products_image);
                
                $products_image_medium = DIR_WS_IMAGES . 'medium/' . $products_image_base . IMAGE_SUFFIX_MEDIUM . $products_image_extension;
                $products_image_large = DIR_WS_IMAGES . 'large/' . $products_image_base . IMAGE_SUFFIX_LARGE . $products_image_extension;
                break;
                
            default:
                break;
        }
    }
}

Mark Brittain
http:\innerlightcrystals.co.uk\sales\

29 Oct 2022, 2:36 AM
#512
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

Thank you lat9. Really appreciate all the hard work.

29 Oct 2022, 2:37 AM
#513
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

brittainmark:

That was not enough either. I have had to change each notifier. Hence, replace whole of \includes\classes\observers\ImageHandlerObserver.php

with

<?php // ----- // Part of the "Image Handler" plugin for Zen Cart 1.5.5b and later. // Copyright (c) 2017-2021 Vinos de Frutas Tropicales // if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } class ImageHandlerObserver extends base { public function __construct() { if (defined('IH_RESIZE') && IH_RESIZE == 'yes') { $this->attach( $this, [ //- From /includes/modules/main_product_image.php 'NOTIFY_MODULES_MAIN_PRODUCT_IMAGE_FILENAME', //- From /includes/modules/additional_images.php 'NOTIFY_MODULES_ADDITIONAL_IMAGES_GET_LARGE', 'NOTIFY_MODULES_ADDITIONAL_IMAGES_THUMB_SLASHES', //- From /includes/pages/popup_image/header_php.php 'NOTIFY_HEADER_END_POPUP_IMAGES', ] ); } } public function update(&$class, $eventID, $p1, &$p2, &$p3, &$p4, &$p5, &$p6) { switch ($eventID) { // ----- // This notifier lets an image-handling observer know that it's time to determine the image information, // providing the following parameters: // // $p1 ... (r/o) ... A copy of the $products_image value // $p2 ... (r/w) ... A boolean value, set by the observer to true if the image has been handled. // $p3 ... (r/w) ... A reference to the $products_image_extension value // $p4 ... (r/w) ... A reference to the $products_image_base value // $p5 ... (r/w) ... A reference to the medium product-image-name // $p6 ... (r/w) ... A reference to the large product-image-name. // // If the observer has set the $product_image_handled flag to true, it's indicated that any of the // other values have been updated for separate handling. // case 'NOTIFY_MODULES_MAIN_PRODUCT_IMAGE_FILENAME': if (strtolower($p3) == '.webp') { break; } $products_image = $p1; $products_image_extension = $p3; $p4 = $products_image_base = preg_replace('/' . $products_image_extension . '$/', '', $products_image); $p5 = DIR_WS_IMAGES . 'medium/' . $products_image_base . IMAGE_SUFFIX_MEDIUM . $products_image_extension; $p6 = DIR_WS_IMAGES . 'large/' . $products_image_base . IMAGE_SUFFIX_LARGE . $products_image_extension; $p2 = true; //-Indicate that the image has been "handled". break; // ----- // This notifier lets any image-handler know the current image being processed, providing the following parameters: // // $p1 ... (r/o) ... The current product's name // $p2 ... (r/w) ... The (possibly updated) filename (including path) of the current additional image. // case 'NOTIFY_MODULES_ADDITIONAL_IMAGES_GET_LARGE': if (strtolower(substr($p2,-5)) == '.webp') { break; } $products_name = $p1; $products_image_large = $p2; if (function_exists('handle_image')) { $newimg = handle_image($products_image_large, addslashes($products_name), LARGE_IMAGE_MAX_WIDTH, LARGE_IMAGE_MAX_HEIGHT, ''); list($src, $alt, $width, $height, $parameters) = $newimg; $p2 = zen_output_string($src); } break; // ----- // This notifier lets any image-handler "massage" the name of the current thumbnail image name with appropriate // slashes for javascript/jQuery display: // // $p1 ... (n/a) ... An empty array, not applicable. // $p2 ... (r/w) ... A reference to the "slashed" thumbnail image name. // case 'NOTIFY_MODULES_ADDITIONAL_IMAGES_THUMB_SLASHES': // remove additional single quotes from image attributes (important!) if (strtolower(substr($p2,-5)) == '.webp') { break; } $thumb_slashes = $p2; $p2 = preg_replace("/([^\\\\])'/", '$1\\\'', $thumb_slashes); break; // ----- // Update the (globally-available) image names for any rendering of the popup_image page. // case 'NOTIFY_HEADER_END_POPUP_IMAGES': global $products_image, $products_image_extension, $products_image_base, $products_image_medium, $products_image_large; if (srttolower($products_image_extension) == '.webp'){ break; } $products_image_base = preg_replace('/' . $products_image_extension . '$/', '', $products_image); $products_image_medium = DIR_WS_IMAGES . 'medium/' . $products_image_base . IMAGE_SUFFIX_MEDIUM . $products_image_extension; $products_image_large = DIR_WS_IMAGES . 'large/' . $products_image_base . IMAGE_SUFFIX_LARGE . $products_image_extension; break; default: break; } } } ``` Thank you brittainmark . I will try your fix and report back.
29 Oct 2022, 3:01 AM
#514
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

brittainmark:

That was not enough either. I have had to change each notifier. Hence, replace whole of \includes\classes\observers\ImageHandlerObserver.php

with

<?php // ----- // Part of the "Image Handler" plugin for Zen Cart 1.5.5b and later. // Copyright (c) 2017-2021 Vinos de Frutas Tropicales // if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } class ImageHandlerObserver extends base { public function __construct() { if (defined('IH_RESIZE') && IH_RESIZE == 'yes') { $this->attach( $this, [ //- From /includes/modules/main_product_image.php 'NOTIFY_MODULES_MAIN_PRODUCT_IMAGE_FILENAME', //- From /includes/modules/additional_images.php 'NOTIFY_MODULES_ADDITIONAL_IMAGES_GET_LARGE', 'NOTIFY_MODULES_ADDITIONAL_IMAGES_THUMB_SLASHES', //- From /includes/pages/popup_image/header_php.php 'NOTIFY_HEADER_END_POPUP_IMAGES', ] ); } } public function update(&$class, $eventID, $p1, &$p2, &$p3, &$p4, &$p5, &$p6) { switch ($eventID) { // ----- // This notifier lets an image-handling observer know that it's time to determine the image information, // providing the following parameters: // // $p1 ... (r/o) ... A copy of the $products_image value // $p2 ... (r/w) ... A boolean value, set by the observer to true if the image has been handled. // $p3 ... (r/w) ... A reference to the $products_image_extension value // $p4 ... (r/w) ... A reference to the $products_image_base value // $p5 ... (r/w) ... A reference to the medium product-image-name // $p6 ... (r/w) ... A reference to the large product-image-name. // // If the observer has set the $product_image_handled flag to true, it's indicated that any of the // other values have been updated for separate handling. // case 'NOTIFY_MODULES_MAIN_PRODUCT_IMAGE_FILENAME': if (strtolower($p3) == '.webp') { break; } $products_image = $p1; $products_image_extension = $p3; $p4 = $products_image_base = preg_replace('/' . $products_image_extension . '$/', '', $products_image); $p5 = DIR_WS_IMAGES . 'medium/' . $products_image_base . IMAGE_SUFFIX_MEDIUM . $products_image_extension; $p6 = DIR_WS_IMAGES . 'large/' . $products_image_base . IMAGE_SUFFIX_LARGE . $products_image_extension; $p2 = true; //-Indicate that the image has been "handled". break; // ----- // This notifier lets any image-handler know the current image being processed, providing the following parameters: // // $p1 ... (r/o) ... The current product's name // $p2 ... (r/w) ... The (possibly updated) filename (including path) of the current additional image. // case 'NOTIFY_MODULES_ADDITIONAL_IMAGES_GET_LARGE': if (strtolower(substr($p2,-5)) == '.webp') { break; } $products_name = $p1; $products_image_large = $p2; if (function_exists('handle_image')) { $newimg = handle_image($products_image_large, addslashes($products_name), LARGE_IMAGE_MAX_WIDTH, LARGE_IMAGE_MAX_HEIGHT, ''); list($src, $alt, $width, $height, $parameters) = $newimg; $p2 = zen_output_string($src); } break; // ----- // This notifier lets any image-handler "massage" the name of the current thumbnail image name with appropriate // slashes for javascript/jQuery display: // // $p1 ... (n/a) ... An empty array, not applicable. // $p2 ... (r/w) ... A reference to the "slashed" thumbnail image name. // case 'NOTIFY_MODULES_ADDITIONAL_IMAGES_THUMB_SLASHES': // remove additional single quotes from image attributes (important!) if (strtolower(substr($p2,-5)) == '.webp') { break; } $thumb_slashes = $p2; $p2 = preg_replace("/([^\\\\])'/", '$1\\\'', $thumb_slashes); break; // ----- // Update the (globally-available) image names for any rendering of the popup_image page. // case 'NOTIFY_HEADER_END_POPUP_IMAGES': global $products_image, $products_image_extension, $products_image_base, $products_image_medium, $products_image_large; if (srttolower($products_image_extension) == '.webp'){ break; } $products_image_base = preg_replace('/' . $products_image_extension . '$/', '', $products_image); $products_image_medium = DIR_WS_IMAGES . 'medium/' . $products_image_base . IMAGE_SUFFIX_MEDIUM . $products_image_extension; $products_image_large = DIR_WS_IMAGES . 'large/' . $products_image_base . IMAGE_SUFFIX_LARGE . $products_image_extension; break; default: break; } } } ``` It seems to be working so far asa temporary fix. Thanks again for it as my log files were starting to pile up. :-) As times goes, it seems that we will have to switch to .webp for all the product images which brings up another question. If I create a new product with a .webp image, do i need to upload 3 different image size for small, medium and large? (since IH will not be resizing/caching then) Thank you
29 Oct 2022, 7:12 PM
#515
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

brittainmark:

That was not enough either. I have had to change each notifier. Hence, replace whole of \includes\classes\observers\ImageHandlerObserver.php

with

<?php // ----- // Part of the "Image Handler" plugin for Zen Cart 1.5.5b and later. // Copyright (c) 2017-2021 Vinos de Frutas Tropicales // if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } class ImageHandlerObserver extends base { public function __construct() { if (defined('IH_RESIZE') && IH_RESIZE == 'yes') { $this->attach( $this, [ //- From /includes/modules/main_product_image.php 'NOTIFY_MODULES_MAIN_PRODUCT_IMAGE_FILENAME', //- From /includes/modules/additional_images.php 'NOTIFY_MODULES_ADDITIONAL_IMAGES_GET_LARGE', 'NOTIFY_MODULES_ADDITIONAL_IMAGES_THUMB_SLASHES', //- From /includes/pages/popup_image/header_php.php 'NOTIFY_HEADER_END_POPUP_IMAGES', ] ); } } public function update(&$class, $eventID, $p1, &$p2, &$p3, &$p4, &$p5, &$p6) { switch ($eventID) { // ----- // This notifier lets an image-handling observer know that it's time to determine the image information, // providing the following parameters: // // $p1 ... (r/o) ... A copy of the $products_image value // $p2 ... (r/w) ... A boolean value, set by the observer to true if the image has been handled. // $p3 ... (r/w) ... A reference to the $products_image_extension value // $p4 ... (r/w) ... A reference to the $products_image_base value // $p5 ... (r/w) ... A reference to the medium product-image-name // $p6 ... (r/w) ... A reference to the large product-image-name. // // If the observer has set the $product_image_handled flag to true, it's indicated that any of the // other values have been updated for separate handling. // case 'NOTIFY_MODULES_MAIN_PRODUCT_IMAGE_FILENAME': if (strtolower($p3) == '.webp') { break; } $products_image = $p1; $products_image_extension = $p3; $p4 = $products_image_base = preg_replace('/' . $products_image_extension . '$/', '', $products_image); $p5 = DIR_WS_IMAGES . 'medium/' . $products_image_base . IMAGE_SUFFIX_MEDIUM . $products_image_extension; $p6 = DIR_WS_IMAGES . 'large/' . $products_image_base . IMAGE_SUFFIX_LARGE . $products_image_extension; $p2 = true; //-Indicate that the image has been "handled". break; // ----- // This notifier lets any image-handler know the current image being processed, providing the following parameters: // // $p1 ... (r/o) ... The current product's name // $p2 ... (r/w) ... The (possibly updated) filename (including path) of the current additional image. // case 'NOTIFY_MODULES_ADDITIONAL_IMAGES_GET_LARGE': if (strtolower(substr($p2,-5)) == '.webp') { break; } $products_name = $p1; $products_image_large = $p2; if (function_exists('handle_image')) { $newimg = handle_image($products_image_large, addslashes($products_name), LARGE_IMAGE_MAX_WIDTH, LARGE_IMAGE_MAX_HEIGHT, ''); list($src, $alt, $width, $height, $parameters) = $newimg; $p2 = zen_output_string($src); } break; // ----- // This notifier lets any image-handler "massage" the name of the current thumbnail image name with appropriate // slashes for javascript/jQuery display: // // $p1 ... (n/a) ... An empty array, not applicable. // $p2 ... (r/w) ... A reference to the "slashed" thumbnail image name. // case 'NOTIFY_MODULES_ADDITIONAL_IMAGES_THUMB_SLASHES': // remove additional single quotes from image attributes (important!) if (strtolower(substr($p2,-5)) == '.webp') { break; } $thumb_slashes = $p2; $p2 = preg_replace("/([^\\\\])'/", '$1\\\'', $thumb_slashes); break; // ----- // Update the (globally-available) image names for any rendering of the popup_image page. // case 'NOTIFY_HEADER_END_POPUP_IMAGES': global $products_image, $products_image_extension, $products_image_base, $products_image_medium, $products_image_large; if (srttolower($products_image_extension) == '.webp'){ break; } $products_image_base = preg_replace('/' . $products_image_extension . '$/', '', $products_image); $products_image_medium = DIR_WS_IMAGES . 'medium/' . $products_image_base . IMAGE_SUFFIX_MEDIUM . $products_image_extension; $products_image_large = DIR_WS_IMAGES . 'large/' . $products_image_base . IMAGE_SUFFIX_LARGE . $products_image_extension; break; default: break; } } } ``` Spoke too soon. The .webp error are gone after doing the change to IHobserver but now i am getting an error with the pop up > [29-Oct-2022 18:53:18 UTC] PHP Fatal error: Call to undefined function srttolower() in /includes/classes/observers/ImageHandlerObserver.php on line 107 > > [29-Oct-2022 18:53:18 UTC] Request URI: /index.php?main_page=popup_image&pID=785, IP address: 54.236.1.13 > --> PHP Fatal error: Call to undefined function srttolower() in /includes/classes/observers/ImageHandlerObserver.php on line 107.
29 Oct 2022, 8:29 PM
#516
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
509
Plugin Contributions:
1

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

That should be strtolower not srttolower sorry typo on line 107

Mark Brittain
http:\innerlightcrystals.co.uk\sales\

29 Oct 2022, 10:51 PM
#517
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

brittainmark:

That should be strtolower not srttolower sorry typo on line 107

Thank you very much

30 Oct 2022, 1:56 AM
#518
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

brittainmark:

That should be strtolower not srttolower sorry typo on line 107

I am still getting the same errorregarding .webp .

[30-Oct-2022 01:53:03 UTC] PHP Notice: Image Handler, calculate_size for /images/red_rose_with_hydrangea.webp returned false; image is corrupt. in /includes/classes/bmz_image_handler.class.php on line 484
[30-Oct-2022 01:53:03 UTC] PHP Notice: Image Handler, calculate_size for /images/red_rose_with_hydrangea.webp returned false; image is corrupt. in /includes/classes/bmz_image_handler.class.php on line 484

I am at loss here on what to do.

Any other suggestions? please

Thank you

30 Oct 2022, 10:56 AM
#519
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
509
Plugin Contributions:
1

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

Have you got the full stack trace (logfile) so I can see where it was called from.

Mark Brittain
http:\innerlightcrystals.co.uk\sales\

30 Oct 2022, 11:37 AM
#520
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
509
Plugin Contributions:
1

Re: Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread

Think I might have found it.

Try altering includes/functions/extra_functions/functions_bmz_image_handler.php
about line 114 from

function handle_image($src, $alt, $width, $height, $parameters)
{
    global $ihConf;

    if ($ihConf['resize']) { //Image Handler processing is enabled

to

function handle_image($src, $alt, $width, $height, $parameters)
{
    global $ihConf;
    $image_ext = strtolower(pathinfo($src, PATHINFO_EXTENSION));
    if ($ihConf['resize'] && ($image_ext != 'webp')) { //Image Handler processing is enabled

Mark Brittain
http:\innerlightcrystals.co.uk\sales\