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 521 to 540 of 774
1 Nov 2022, 2:49 AM
#521
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

brittainmark:

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

Sorry for the delay to report.

When i first tried to alter includes/functions/extra_functions/functions_bmz_image_handler.php, the link to the .webp image appeared broken.

However, i forgot i reverted the previous change to the observer.

After altering both files, the .webp error seems to be gone ( at least in the last 2 days )

Thank you to brittainmark for providing the fix.

Now, I am facing another "bug" thatmay or may not be related to IH:

If i use a .webp image for a banner, the image is being resized to my small image admin settings.

If i use a jpg, png...image for the same banner, the image is display to the image initial size.

Is this a normal behavior? I didn't know that IH and/or ZC would resize .webp image when use in banners.

Is there a way to fix it?

Thank you

1 Nov 2022, 5:48 PM
#522
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

The changes I suggested to image handler mean that it does not touch images with the extension .webp therefore I would suggest it is another issue unless image handler was changing the jpeg/gif image to a new size. If you look at a none webp image, what is the image name in the banner?

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

2 Nov 2022, 2:31 AM
#523
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:

The changes I suggested to image handler mean that it does not touch images with the extension .webp therefore I would suggest it is another issue unless image handler was changing the jpeg/gif image to a new size. If you look at a none webp image, what is the image name in the banner?

My apologies. The change you suggested are working.

It appears to be different issue but it still involves.webp images unfortunately as far as I can tell.

The banner can be seen at royal-fleurdotcom.

The image is named fall banner.jpg with a resolution of 900 x 360.

If I use fall banner.webp with same resolution, it gets resized to 400x150 with 400 being my max small image width.

Not sure why it is doing itor if it is IH entirely related. Other .webp image are fine except when it comes to banner.

2 Nov 2022, 9:17 AM
#524
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:

My apologies. The change you suggested are working.

It appears to be different issue but it still involves.webp images unfortunately as far as I can tell.

The banner can be seen at royal-fleurdotcom.

The image is named fall banner.jpg with a resolution of 900 x 360.

If I use fall banner.webp with same resolution, it gets resized to 400x150 with 400 being my max small image width.

Not sure why it is doing itor if it is IH entirely related. Other .webp image are fine except when it comes to banner.
If IH isn't managing the image (per @brittainmark's suggested change), then it's not involved in anything to do with the associated image ... although it looks like you've got it sorted out. What changed?

4 Nov 2022, 2:17 AM
#525
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

lat9:

If IH isn't managing the image (per @brittainmark's suggested change), then it's not involved in anything to do with the associated image ... although it looks like you've got it sorted out. What changed?

The suggested change by brittainmark took care of the .webp issues and IH is not throwing errors anymore when encountering this format.

I haven t figure out the banner part yet and reverted tousing .jpg image for now. Not sure why it is behaving this and will have to experiment a bit more. For now, image in .webp in banner are resized to small image setting from admin.

I am not sure if it is IH related either. JPG image are not resized and are displayed to their uploaded size when used in banners.

18 Nov 2022, 12:12 PM
#526
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

Image Handler 5, v5.3.1 is now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2169

This release contains changes associated with the following GitHub issues:

#263: Define all class variables, PHP 8.2+ requirement.
#265: Don't process images, e.g. those with a .webp extension, that aren't resizeable via PHP built-in functions.

27 Jan 2023, 11:17 AM
#527
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

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

ZC v1.5.8

The background colour of small images is set, in IH5, by specifying SMALL_IMAGE_BACKGROUND in Admin. I use this feature and it works well for my Product Listing pages but I would like to set a different background colour for those small images that appear on the product_info pages, namely additional images.

How would I go about setting this up for additional images? An acceptable, and possibly easier, alternative would be to set a different background color for ALL images on the product_info page.

Edit: should not have replied to 'Re: Hover image alignment' post

Simon

27 Jan 2023, 11:48 AM
#528
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

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

I had thought something like this, in \includes\functions\extra_functions\functions_bmz_image_handler.php to use the MEDIUM_IMAGE_BACKGROUND colour for small images on product_info pages

global $current_page_base;
if ($current_page_base == ('product_info')) {
$ihConf['small']['bg']          = defined('MEDIUM_IMAGE_BACKGROUND') ? MEDIUM_IMAGE_BACKGROUND : $ihConf['default']['bg'];
} else {
$ihConf['small']['bg']          = defined('SMALL_IMAGE_BACKGROUND') ? SMALL_IMAGE_BACKGROUND : $ihConf['default']['bg'];
}

but no.

Simon

27 Jan 2023, 12:07 PM
#529
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

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

simon1066:

I had thought something like this, in \includes\functions\extra_functions\functions_bmz_image_handler.php to use the MEDIUM_IMAGE_BACKGROUND colour for small images on product_info pages

global $current_page_base;
if ($current_page_base == ('product_info')) {
$ihConf['small']['bg'] = defined('MEDIUM_IMAGE_BACKGROUND') ? MEDIUM_IMAGE_BACKGROUND : $ihConf['default']['bg'];
} else {

$ihConf['small']['bg'] = defined('SMALL_IMAGE_BACKGROUND') ? SMALL_IMAGE_BACKGROUND : $ihConf['default']['bg'];
}

> 
> but no.

Actually, there's no way that would have worked.

Simon

27 Jan 2023, 3:08 PM
#530
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

@simon1066, are you using any of the URL manglers (e.g. USU or Ceon URI Mappings). There might be a relatively easy to accomplish what you're looking to do if you're not.

27 Jan 2023, 3:47 PM
#531
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

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

lat9:

@simon1066, are you using any of the URL manglers (e.g. USU or Ceon URI Mappings). There might be a relatively easy to accomplish what you're looking to do if you're not.

Yes @lat9, Ceon URI Mapping

Edit: just reread

Simon

27 Jan 2023, 4:05 PM
#532
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

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

simon1066:

ZC v1.5.8

The background colour of small images is set, in IH5, by specifying SMALL_IMAGE_BACKGROUND in Admin. I use this feature and it works well for my Product Listing pages but I would like to set a different background colour for those small images that appear on the product_info pages, namely additional images.

How would I go about setting this up for additional images? An acceptable, and possibly easier, alternative would be to set a different background color for ALL images on the product_info page.

Edit: should not have replied to 'Re: Hover image alignment' post

Give the number of additional images I have, it's not a huge issue if this going to prove too onerous. I can edit/prepare the images in advance - just wanted to avoid doing so.

Simon

1 Feb 2023, 5:38 PM
#533
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

simon1066:

Give the number of additional images I have, it's not a huge issue if this going to prove too onerous. I can edit/prepare the images in advance - just wanted to avoid doing so.
You could use a site-specific init_includes module (you'll need to add an auto_loader, too) that loads somewhere around CP 200 that makes the change to $ihConf (it's a global variable) as you'd identified a couple of posts back.

1 Feb 2023, 9:54 PM
#534
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

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

load_imageGD() - I wonder if rather than assuming the extension was correct if it would make sense (perhaps optionally) to do a getimagesize.
I see cases where images have a .gif extension but they're actually JPGs.

--> PHP Warning: imagecreatefromgif(): '/home/client/public_html/images/folder/l_699-902-016_2.gif' is not a valid GIF file in /home/client/public_html/includes/classes/bmz_image_handler.class.php on line 939.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

1 Feb 2023, 10:58 PM
#535
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

swguy:

load_imageGD() - I wonder if rather than assuming the extension was correct if it would make sense (perhaps optionally) to do a getimagesize.
I see cases where images have a .gif extension but they're actually JPGs.

--> PHP Warning: imagecreatefromgif(): '/home/client/public_html/images/folder/l_699-902-016_2.gif' is not a valid GIF file in /home/client/public_html/includes/classes/bmz_image_handler.class.php on line 939.
I've seen those logs before, too. Rather than slow the image-processing down for everybody, I've told the site's back-office staff to fix the image.

1 Feb 2023, 11:33 PM
#536
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

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

These are drop shipper supplied images; there's really no hope of getting them fixed in this case. That's why I suggested a switchable (disabled by default; optionally enabled) feature to be more robust in the case of invalid images.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

2 Feb 2023, 2:51 PM
#537
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

swguy:

These are drop shipper supplied images; there's really no hope of getting them fixed in this case. That's why I suggested a switchable (disabled by default; optionally enabled) feature to be more robust in the case of invalid images.
I'll entertain a PR for this, but it feels like a one-off type issue.

Is anyone else running into this?

5 Feb 2023, 11:59 AM
#538
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

I have sent a pr.

If this is good, may be a way to allow WebP images as well.

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

5 Feb 2023, 12:41 PM
#539
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

brittainmark:

I have sent a pr.

If this is good, may be a way to allow WebP images as well.
Sounds good; I'll note that I've just *discovered *(i.e. actually searched the documentation) that PHP *does *have support for webp images, so that's another possibility that's been requested before.

6 Feb 2023, 7:41 PM
#540
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 sent pr to make work with webp

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