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

Image Handler 4 (for v1.5.x) Support Thread

Started by divavocals on 8 Apr 2012, 5:13 AM · Views: 345,214

Results 1,581 to 1,600 of 1,691
27 Dec 2016, 6:15 PM
#1581
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Post #1581 by carlwhat

carlwhat:

i think i have spoken about this before.... unfortunately my memory is not what it once was....

while certain uses of '@' to suppress error messages are possibly worth wild, the inordinate amount of them in this plugin makes it rather frustrating.

the bmz_image_handler.class.php file will suppress error messages and cause a script to fail. specifically the functions:

imagecreatefromgif
imagecreatefrompng
imagecreatefromjpeg

i'm not sure how many others have clients who do not know the difference between a jpg and a png; but mine don't and will use whatever extension they feel like. so now you have a script failing and no error messages.... kind of a pain....

in addition, there is a php function: exif_imagetype() which will determine the file type. now i know i could make some changes and submit a new version, but prior to doing that, i'm curious if other people have this same problem.

in the interest of others who might have this problem, this corrected code works for me. it eliminates some functionality, but it removes the troubleshooting when someone uploads an image with the wrong file type. i suppose one could correct the filetype, but i think that might be a bunch more work.

	function load_imageGD($src_name) {
		// create an image of the given filetype
		$file_ext = substr($src_name, strrpos($src_name, '.'));
                $image_type = exif_imagetype($src_name);
		switch (strtolower($file_ext)) {
			case '.gif':
			    if(!function_exists("imagecreatefromgif")) return false;
                            if ($image_type == 1) {
                               $image = imagecreatefromjpeg($src_name);
                            } else {
                               return false;
                            }
			break;
			case '.png':
			    if(!function_exists("imagecreatefrompng")) return false;
                            if ($image_type == 3) {
                               $image = imagecreatefromjpeg($src_name);
                            } else {
                               return false;
                            }
			break;
			case '.jpg':
			case '.jpeg':
			    if(!function_exists("imagecreatefromjpeg")) return false;
                            if ($image_type == 2) {
                               $image = imagecreatefromjpeg($src_name);
                            } else {
                               return false;
                            }
			break;
		}
		return $image;
	}

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

28 Dec 2016, 3:17 AM
#1582
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Post #1582 by carlwhat

i'm a copy and paste disaster.... small change from above code.... my apologies!

	function load_imageGD($src_name) {
		// create an image of the given filetype
		$file_ext = substr($src_name, strrpos($src_name, '.'));
                $image_type = exif_imagetype($src_name);
		switch (strtolower($file_ext)) {
			case '.gif':
			    if(!function_exists("imagecreatefromgif")) return false;
                            if ($image_type == 1) {
                               $image = imagecreatefromgif($src_name);
                            } else {
                               return false;
                            }
			    break;
			case '.png':
			    if(!function_exists("imagecreatefrompng")) return false;
                            if ($image_type == 3) {
                               $image = imagecreatefrompng($src_name);
                            } else {
                               return false;
                            }
			    break;
			case '.jpg':
			case '.jpeg':
			    if(!function_exists("imagecreatefromjpeg")) return false;
                            if ($image_type == 2) {
                               $image = imagecreatefromjpeg($src_name);
                            } else {
                               return false;
                            }
			    break;
		}
		return $image;
	}

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

28 Dec 2016, 7:03 AM
#1583
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #1583 by mc12345678

carlwhat:

i'm a copy and paste disaster.... small change from above code.... my apologies!

function load_imageGD($src_name) {
    // create an image of the given filetype
    $file_ext = substr($src_name, strrpos($src_name, '.'));
            $image_type = exif_imagetype($src_name);
    switch (strtolower($file_ext)) {
        case '.gif':
            if(!function_exists("imagecreatefromgif")) return false;
                        if ($image_type == 1) {
                           $image = imagecreatefromgif($src_name);
                        } else {
                           return false;
                        }
            break;
        case '.png':
            if(!function_exists("imagecreatefrompng")) return false;
                        if ($image_type == 3) {
                           $image = imagecreatefrompng($src_name);
                        } else {
                           return false;
                        }
            break;
        case '.jpg':
        case '.jpeg':
            if(!function_exists("imagecreatefromjpeg")) return false;
                        if ($image_type == 2) {
                           $image = imagecreatefromjpeg($src_name);
                        } else {
                           return false;
                        }
            break;
    }
    return $image;
}
So now instead of an obvious display issue identifying that there is a problem with the image(s), an incorrectly loaded image will just not be resized and the store owner that doesn't/hasn't properly loaded the images to the site will be none-the-wiser until some other tool or resource identifies that the image(s) should be resized to optimize performance or there is some other effect on people selecting the site...

In other words, has anything really been solved? I bring this up also because other similar modifications have been discussed throughout this thread as well as in other threads, in fact if you look back at the history of the plugin errors have been uncommented before only to be again commented out like what has been "discouraging". 

Generally though, the solution?!  Follow the instructions...  

Seems almost might be better to simply remove the plugin if it can not be used properly.

If, however, going to use code like above, I would recommend that the applicable image type constant be used to maximize compatibility and code understanding when comparing the image type against $image_type. Such as: IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_PNG, etc. instead of just a number.  Based on looking over a few other things it seems that if going to go to such extremes, then should also validate that the image is large enough to support evaluation with the applicable function so that won't throw another error that was just attempted to be prevented.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

28 Dec 2016, 8:26 AM
#1584
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Post #1584 by carlwhat

mc12345678:

So now instead of an obvious display issue identifying that there is a problem with the image(s), an incorrectly loaded image will just not be resized and the store owner that doesn't/hasn't properly loaded the images to the site will be none-the-wiser until some other tool or resource identifies that the image(s) should be resized to optimize performance or there is some other effect on people selecting the site...

In other words, has anything really been solved? I bring this up also because other similar modifications have been discussed throughout this thread as well as in other threads, in fact if you look back at the history of the plugin errors have been uncommented before only to be again commented out like what has been "discouraging".

Generally though, the solution?! Follow the instructions...

Seems almost might be better to simply remove the plugin if it can not be used properly.

If, however, going to use code like above, I would recommend that the applicable image type constant be used to maximize compatibility and code understanding when comparing the image type against $image_type. Such as: IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_PNG, etc. instead of just a number. Based on looking over a few other things it seems that if going to go to such extremes, then should also validate that the image is large enough to support evaluation with the applicable function so that won't throw another error that was just attempted to be prevented.

#1 a mostly blank page with NO error log generated is what the current code does. your "average joe" gets a blank page, posts on this forum, and the 1st question, most of us ask, "are there any debug logs?" no debug logs makes the task that much harder.
#2 i agree. follow the instructions. when you only have clients that follow instructions, life is so much easier.... please pass those clients my way....
#3 i disagree with regards to your remove the plugin comment.
#4 perhaps just remove the '@' from the above 3 referenced functions? the functionality remains the same and the system now generates debug logs.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

30 Dec 2016, 5:15 PM
#1585
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Post #1585 by carlwhat

mc12345678:

If, however, going to use code like above, I would recommend that the applicable image type constant be used to maximize compatibility and code understanding when comparing the image type against $image_type. Such as: IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_PNG, etc. instead of just a number. Based on looking over a few other things it seems that if going to go to such extremes, then should also validate that the image is large enough to support evaluation with the applicable function so that won't throw another error that was just attempted to be prevented.
i beg to differ that using a numeric value affects compatibility in any way. i agree that using the constant helps in readability.

given that, i think the following code addresses the problems i have encountered and is an improvement over the base code in this plugin. i have chosen to not do any of the size validations.

	function load_imageGD($src_name) {
		// create an image of the given filetype
		$file_ext = substr($src_name, strrpos($src_name, '.'));
        $image_type = exif_imagetype($src_name);
        switch ($image_type) {
            case 'IMAGETYPE_GIF':
                if(!function_exists("imagecreatefromgif")) return false;
                    $image = imagecreatefromgif($src_name);
                break;
            case 'IMAGETYPE_PNG':
                if(!function_exists("imagecreatefrompng")) return false;
                    $image = imagecreatefrompng($src_name);
                break;
            case 'IMAGETYPE_JPEG':
                if(!function_exists("imagecreatefromjpeg")) return false;
                    $image = imagecreatefromjpeg($src_name);
                break;
        }
		return $image;

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

11 Jan 2017, 11:52 AM
#1586
heathenmagic avatar

heathenmagic

Totally Zenned

Join Date:
May 2005
Location:
England
Posts:
733
Plugin Contributions:
0

Post #1586 by heathenmagic

Hello there,

I know CDN is not supposed to be compatible with CDN, but our hosts suggested a way to enter some code in .htaccess to fetch images from the CDN urls. I know this is probably doubtful, but thought I would just throw it out there anyhow.

16 Jan 2017, 5:37 PM
#1587
jodean avatar

jodean

Totally Zenned

Join Date:
May 2011
Location:
Tennessee
Posts:
511
Plugin Contributions:
0

Post #1587 by jodean

I upgraded my site to Zen Cart 1.5.5. Now my product images no longer display. Does anyone know how to uninstall Image Handler 4?

Did not find any uninstall instructions in the download.

16 Jan 2017, 10:29 PM
#1588
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Post #1588 by carlwhat

jodean:

I upgraded my site to Zen Cart 1.5.5. Now my product images no longer display. Does anyone know how to uninstall Image Handler 4?

Did not find any uninstall instructions in the download.

Admin -> Tools -> Image Handler

then click

Uninstall Image Handler

I have not tried this so i can not attest as to if it actually works...

good luck!

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

26 Jan 2017, 1:06 PM
#1589
cubmanky avatar

cubmanky

Zen Follower

Join Date:
Jan 2014
Posts:
224
Plugin Contributions:
0

Post #1589 by cubmanky

using V1.5.4 All has been working great except I have one product that when i try to add a second photo I get the following

Gateway Timeout
Server error - server 160.153.46.130 is unreachable at this moment.
Please retry the request or contact your administrator.

18 Mar 2017, 2:07 AM
#1590
sports_guy avatar

sports_guy

Totally Zenned

Join Date:
Apr 2007
Location:
Dayton, Ohio
Posts:
682
Plugin Contributions:
0

Post #1590 by sports_guy

Does image handler work with ZC v1.5.5a? In the downloads area it only lists versions 1.5.0 and 1.5.1. Unless there is another download area that has an update?

Building a better web, one site at a time: Dayton Web Design

17 May 2017, 12:59 AM
#1592
mikeyg avatar

mikeyg

Totally Zenned

Join Date:
May 2005
Posts:
515
Plugin Contributions:
0

Post #1592 by mikeyg

I am not sure to post here or in the Ceon URL Mapping thread so please accept my apologies if this is the wrong one.

Has anyone had an issue with this mod running with the above mod.

Images were available when I select a product and I could add the extra images in. But now I cannot select a product with out the page looping back through to the initial image handler page which just has the following

Image Handler4
No Image Handler information found.
Image Manager Admin Tools Preview About/Help
Uninstall Image Handler. (Please backup your site and database first)
Clear image cache
Scan for old IH 0.x and 1.x original images

I have only noticed this happening with the install of the CEON URL mapping. Is there a cure for this conflict other than uninsalling the ceon mod.

Thanks in advance. Running zc 1.5.5e and the latest version of all mods mentioned.

17 May 2017, 6:35 PM
#1593
mikeyg avatar

mikeyg

Totally Zenned

Join Date:
May 2005
Posts:
515
Plugin Contributions:
0

Post #1593 by mikeyg

Well I have gone through the install again and seemed to have go the back end working as expected but now the images on the product info page disappear when you click on them. A small image pops up and then the large main image on the infopage behind it disappears. The same happens when clicking on additional images.

17 May 2017, 8:02 PM
#1594
mikeyg avatar

mikeyg

Totally Zenned

Join Date:
May 2005
Posts:
515
Plugin Contributions:
0

Post #1594 by mikeyg

Solved my own issue by reading the install again and the clash seems to be with the tableau template and the lightbox and the additional_images.php files in the modules/mytemplate/ folder.

it pays to rtfm ;-)

24 May 2017, 5:03 PM
#1595
jpda avatar

jpda

Zen Follower

Join Date:
Jun 2014
Posts:
157
Plugin Contributions:
0

Post #1595 by jpda

Hi All,

I have IH4 (from github) installed in zc v1.5.5e, template Winchester Responsive. Both running fine.
But, Winchester Responsive (WR) has Zen Colorbox and there is a problem in combination with IH4.
IH4's jscript_imagehover.js seems to conflict with WR's slimmenu.
I have posted this at WR's support thread here https://www.zen-cart.com/showthread.php?213234-Winchester-Responsive&p=1330216#post1330216, referring to someone's post at the WR support thread.

The hover function is working well, but the "slimmenu" will not work then. Just disabling the hover function in admin will not help, only removing jscript_imagehover.js makes slimmenu working.

Anybody having any ideas how to solve this?

Thanks,
jpda

24 May 2017, 6:26 PM
#1596
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #1596 by mc12345678

jpda:

Hi All,

I have IH4 (from github) installed in zc v1.5.5e, template Winchester Responsive. Both running fine.
But, Winchester Responsive (WR) has Zen Colorbox and there is a problem in combination with IH4.
IH4's jscript_imagehover.js seems to conflict with WR's slimmenu.
I have posted this at WR's support thread here https://www.zen-cart.com/showthread.php?213234-Winchester-Responsive&p=1330216#post1330216, referring to someone's post at the WR support thread.

The hover function is working well, but the "slimmenu" will not work then. Just disabling the hover function in admin will not help, only removing jscript_imagehover.js makes slimmenu working.

Anybody having any ideas how to solve this?

Thanks,
jpda

This is/was an issue identified (with a proposed fix) by torvista in the Issues section of the github repo: https://github.com/DivaVocals/zen_Image-Handler/issues/13

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

24 May 2017, 9:09 PM
#1597
jpda avatar

jpda

Zen Follower

Join Date:
Jun 2014
Posts:
157
Plugin Contributions:
0

Post #1597 by jpda

mc12345678:

This is/was an issue identified (with a proposed fix) by torvista in the Issues section of the github repo: https://github.com/DivaVocals/zen_Image-Handler/issues/13

Thanks a lot, mc12345678 an torvista, that solution worked! :clap:
For those who have the same problem:
The file to be changed is jscript_imagehover.js, not jscript_imagehover.php.

Cheers,

jpda

16 Jun 2017, 4:16 PM
#1598
vandiermen avatar

vandiermen

Totally Zenned

Join Date:
Feb 2007
Posts:
518
Plugin Contributions:
1

Post #1598 by vandiermen

mc12345678:

This is/was an issue identified (with a proposed fix) by torvista in the Issues section of the github repo: https://github.com/DivaVocals/zen_Image-Handler/issues/13

I downloaded github version, updated the code, tried different templates (default responsive, classic and custom), tried it on default zc install, and still not working.

document.addEventListener("DOMContentLoaded", function (event) {    if (document.getElementById || document.all) {        document.body.innerHTML += '<div id="trailimageid"></div>';    }});

to

window.addEventListener("load", function () { document.body.insertAdjacentHTML('beforeend', '<div id="trailimageid"></div>') });

?
Is this fix not working for anyone else?

16 Jun 2017, 5:30 PM
#1599
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #1599 by mc12345678

vandiermen:

I downloaded github version, updated the code, tried different templates (default responsive, classic and custom), tried it on default zc install, and still not working.

document.addEventListener("DOMContentLoaded", function (event) { if (document.getElementById || document.all) { document.body.innerHTML += '<div id="trailimageid"></div>'; }});

> to 
> ```php
window.addEventListener("load", function () { document.body.insertAdjacentHTML('beforeend', '<div id="trailimageid"></div>') });

?
Is this fix not working for anyone else?

Just to be sure that staying or will stay on the correct topic, in trying each of the template's, the "install" for that template was incorporated, correct? Also, is the issue still just that the image view on hover is affected or is it more?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

19 Jun 2017, 5:29 PM
#1600
vandiermen avatar

vandiermen

Totally Zenned

Join Date:
Feb 2007
Posts:
518
Plugin Contributions:
1

Post #1600 by vandiermen

mc12345678:

Just to be sure that staying or will stay on the correct topic, in trying each of the template's, the "install" for that template was incorporated, correct? Also, is the issue still just that the image view on hover is affected or is it more?

I just checked again, and the item I was testing had _MED.gif extension, so i added a new product and IH is working on the new products. So maybe I am ok now. However...
On one of the demo products did not have an extension _MED and image still not resizing, maybe something with the demo product images? (they are already small?

My products: http://www.electricmotorshop.com.au/testdel/index.php?main_page=product_info&cPath=1_17&products_id=180
Demo product with no _MED extension: http://www.electricmotorshop.com.au/testdel/index.php?main_page=product_info&cPath=1_4&products_id=1

It's a not an issue for me as long as my own products are working

In trying each of the template, I re-installed the image handler and the files were changed in each template.
IH resize images was not working (where IH resizes and changes image to the bmz_cache)