New Zenner
- Join Date:
- Jan 2015
- Location:
- Seminole FL 33777
- Posts:
- 7
- Plugin Contributions:
- 0
Image Handler 4 (for v1.5.x) Support Thread
Okay, which file do you think it is that needs to be restored to original, then compared against Image Handler?
Views: 343,291
New Zenner
Okay, which file do you think it is that needs to be restored to original, then compared against Image Handler?
Totally Zenned
sunshinelock:
Okay, which file do you think it is that needs to be restored to original, then compared against Image Handler?
I couldn't say.. Suggest comparing them ALL.. and seeing where your code differs from what is in the Image Handler files.. BTW, IH4 currently available inthe downloads has NOT yet been updated/tested with v1.5.4 of Zen Cart..
New Zenner
I had to delete the templates/tableau/templates/tpl_main_product_image.php to get the proper 1st image to pop up again.
Problem 2 is the 2nd image. I'll post when I find the solution to that.
Totally Zenned
DivaVocals:
Not sure that this is aused by Image Handler.. Likely caused by whatever other image module you have installed or that came bundled with Tableau..
Personally I wish template authors would NOT bundle in things like lightboxes and Image Handler in with their templates.. they are GOTCHAS waiting to happen IMHO..
Yep, Tableau is one of the worst, the only thing that is not included in the package is Zen Cart :laugh:
Totally Zenned
Design75:
Yep, Tableau is one of the worst, the only thing that is not included in the package is Zen Cart :laugh:
snickers
The problem with all this bundling besides the fact that I don't always LIKE the bundling choices the author makes in choosing the bundled modules (ie: I prefer Zen Colorbox, & the author may bundle in Zen Lightbox for example) is that it sometimes makes troubleshooting issues a bit tricky.. Can't tell what's caused by the template, and what's caused by the module, or what's being caused by something else bundled in.. :huh: If sunshinelock's issues started RIGHT after installing the template, and the template was installed over a VANILLA Zen Cart install, I'd say the best bet is to go to the author of the template and ask them for assistance to resolve.. I am personally not going to be able to spend a lot of time trying to GUESS what MIGHT be the solution as my free time is limited.. Don't know what effect some of the modules bundled in with this particular template might have..
Totally Zenned
Had this little glitch before on another site with IH3 and wound up dropping it as we found no answer. Just had this (and two others show up on a recent upgrade to 1.5.4.
[04-Feb-2015 16:25:51 America/Chicago] #1 strstr() called at [/home/OURSITE/public_html/includes/classes/bmz_image_handler.class.php:129]
#2 ih_image->determine_image_sizetype() called at [/home/OURSITE/public_html/includes/classes/bmz_image_handler.class.php:55]
#3 ih_image->ih_image() called at [/home/OURSITE/public_html/includes/functions/extra_functions/functions_bmz_image_handler.php:55]
#4 handle_image() called at [/home/OURSITE/public_html/includes/functions/html_output.php:187]
#5 zen_image() called at [/home/OURSITE/public_html/includes/templates/template_default/popup_image/tpl_main_page.php:17]
#6 require(/home/OURSITE/public_html/includes/templates/template_default/popup_image/tpl_main_page.php) called at [/home/OURSITE/public_html/index.php:97][04-Feb-2015 16:25:51 America/Chicago] PHP Warning: strstr(): Empty needle in /home/enignet/public_html/includes/classes/bmz_image_handler.class.php on line 129
Please note that this was NOT caused by either a faulty installation or the mod itself.
We found the problem absolutely by accident.
SOLUTION:
Somehow, the menu entry for Configuration >> Images >> Product Info - Image Large Suffix was BLANK:shocking: The default is _LRG. Adding this back into the menu item cured the problem.
The symptom that led us to the _LRG setting was that IH4 was working fine EXCEPT when looking at the large image on a product's page. Also, when viewing a product in the IH4 Image Manager, there was no Large size image shown.
Again, this was not a fault of the installation or IH4 itself.
Might be something to consider having the setup look for when auto-loading. It could say something like, "Your Images >> Product Info - Image Suffixes cannot be blank. IH4 does not care if the suffix is _LRG or _GRL BUT it does need something there in both the Medium and Large or it will throw the error above.
Totally Zenned
Time out got me. Meant to add
BTW: Everything is working well with 1.5.4, Apache, 5.4.36 PHP, 5.5.40-cll MySQL
Totally Zenned
dbltoe:
Had this little glitch before on another site with IH3 and wound up dropping it as we found no answer. Just had this (and two others show up on a recent upgrade to 1.5.4.
Please note that this was NOT caused by either a faulty installation or the mod itself.
We found the problem absolutely by accident.
SOLUTION:
Somehow, the menu entry for Configuration >> Images >> Product Info - Image Large Suffix was BLANK:shocking: The default is _LRG. Adding this back into the menu item cured the problem.The symptom that led us to the _LRG setting was that IH4 was working fine EXCEPT when looking at the large image on a product's page. Also, when viewing a product in the IH4 Image Manager, there was no Large size image shown.
Again, this was not a fault of the installation or IH4 itself.
Might be something to consider having the setup look for when auto-loading. It could say something like, "Your Images >> Product Info - Image Suffixes cannot be blank. IH4 does not care if the suffix is _LRG or _GRL BUT it does need something there in both the Medium and Large or it will throw the error above.
Wow!!! Nice catch!!! Don't cha just LOVE la9's backtrace plugin!!!! Handy as HE!! for tracing strange issues..
Now how to fix/prevent from happening again..
Hmmmm..
Thinking that adding a warning to the auto-installer is absolutely correct (and I'll see if I can figure out how to do that), but I'm wondering if in addition to that perhaps the auto-installer should just update the value to _LRG if this is found to contain a blank or NULL value (something I KNOW I can manage to update:laugh:)..
OR..
Maybe the auto installer should update the value to DON'T_DELETE_THIS_OR_IMAGE_HANDLER_WILL_BREAK :laugh:
Totally Zenned
backtrace is good but it wasn't used. Just happened to have two admin menus up from different sites and saw the missing _LRG. When you click to edit, it tells you that the default is _LRG.
Same thing happens with _MED just LOTS MORE WORSER.
Perhaps the installer should change them both to _BOO:shocking:
Totally Zenned
dbltoe:
backtrace is good but it wasn't used.Oh I realized you found the problem without backtrace..:smile: I just recognized the backtrace output from your error log..
dbltoe:
Just happened to have two admin menus up from different sites and saw the missing _LRG. When you click to edit, it tells you that the default is _LRG.
Same thing happens with _MED just LOTS MORE WORSER.GADS!!! Found a similar kind of weird one off issue just two days ago with COWOA..
Thanks for sharing this.. I was gonna pull the trigger on the new IH4 this weekend.. Hoping that this is a QUICK fix for me to make happen..
dbltoe:
Perhaps the installer should change them both to _BOO:shocking:snickers
Totally Zenned
Quote Originally Posted by dbltoe View Post
Perhaps the installer should change them both to _BOO
that would not be so hard. But it would be much better to mend the mod itself so that if the setting was blank it didn't create an error. Judging from the errors what is happening is that IH is checking to see if a large image exists. It is matching the suffix, _LRG (or whatever).
It shouldn't be too hard to put a conditional around all that code so that if the suffix is blank it doesn't even bother looking for a large image.
If not having any suffix messes up any other aspects of images implicit in Zen, which is possible, then it would be better to put code in Zen that assured that the setting could never be blank.
Relying on the auto-installer only to ensure that the setting is not blank seems like a band-aid.
Totally Zenned
niccol:
Relying on the auto-installer only to ensure that the setting is not blank seems like a band-aid.Of course it is.. But it's a bandaid that I KNOW how to create.. You know I'm not REALLY a developer.. I only play one on TV..:laugh:
Totally Zenned
DivaVocals:
Of course it is.. But it's a bandaid that I KNOW how to create.. You know I'm not REALLY a developer.. I only play one on TV..:laugh:
Yeah, but it is probably easier to change the module than change the auto-installer :-) You've got the line number form the errors
[04-Feb-2015 16:25:51 America/Chicago] PHP Warning: strstr(): Empty needle in /home/enignet/public_html/includes/classes/bmz_image_handler.class.php on line 129
You are probably going to do something like this
function determine_image_sizetype() {
global $ihConf;
if (strstr($this->src, $ihConf['large']['suffix'])) {
$this->sizetype = 'large';
} elseif (strstr($this->src, $ihConf['medium']['suffix'])) {
$this->sizetype = 'medium';
} elseif ((intval($this->width) == intval($ihConf['small']['width'])) && (intval($this->height) == intval($ihConf['small']['height']))) {
$this->sizetype = 'small';
} else
$this->sizetype = 'generic';
}
changed to:
function determine_image_sizetype() {
global $ihConf;
$this->sizetype = 'generic';
if($ihConf['large']['suffix'] != '')
{
if (strstr($this->src, $ihConf['large']['suffix'])) {
$this->sizetype = 'large';
}
}
if($ihConf['medium']['suffix'] != '')
{
if (strstr($this->src, $ihConf['medium']['suffix'])) {
$this->sizetype = 'medium';
}
}
if($ihConf['large']['small'] != '')
{
if (strstr($this->src, $ihConf['small']['suffix'])) {
$this->sizetype = 'small';
}
}
}
Off the top of my head and without looking at any of the other areas or consequences.
Totally Zenned
niccol:
Yeah, but it is probably easier to change the module than change the auto-installer :-) You've got the line number form the errors
[04-Feb-2015 16:25:51 America/Chicago] PHP Warning: strstr(): Empty needle in /home/enignet/public_html/includes/classes/bmz_image_handler.class.php on line 129
>
> You are probably going to do something like this
>
> ```
function determine_image_sizetype() {
global $ihConf;
if (strstr($this->src, $ihConf['large']['suffix'])) {
$this->sizetype = 'large';
} elseif (strstr($this->src, $ihConf['medium']['suffix'])) {
$this->sizetype = 'medium';
} elseif ((intval($this->width) == intval($ihConf['small']['width'])) && (intval($this->height) == intval($ihConf['small']['height']))) {
$this->sizetype = 'small';
} else
$this->sizetype = 'generic';
}
changed to:
function determine_image_sizetype() {
global $ihConf;
$this->sizetype = 'generic';
if($ihConf['large']['suffix'] != '')
{
if (strstr($this->src, $ihConf['large']['suffix'])) {
$this->sizetype = 'large';
}
}
if($ihConf['medium']['suffix'] != '')
{
if (strstr($this->src, $ihConf['medium']['suffix'])) {
$this->sizetype = 'medium';
}
}
if($ihConf['large']['small'] != '')
{
if (strstr($this->src, $ihConf['small']['suffix'])) {
$this->sizetype = 'small';
}
}
}
>
> Off the top of my head and without looking at any of the other areas or consequences.
I would suggest either of the following two depending on the desired goal. First would be to prevent the error in this section of code, but wouldn't address similar potential problems later on, the second would set the variables in this section of code but also may still have the issue later, either way, an example to address the issue and maintain existing functionality. The example above appears to lead to all images being the size of the last defined size.
function determine_image_sizetype() {
global $ihConf;
if (zen_not_null($ihConf['large']['suffix']) && strstr($this->src, $ihConf['large']['suffix'])) {
$this->sizetype = 'large';
} elseif (zen_not_null($ihConf['medium']['suffix']) && strstr($this->src, $ihConf['medium']['suffix'])) {
$this->sizetype = 'medium';
} elseif ((intval($this->width) == intval($ihConf['small']['width'])) && (intval($this->height) == intval($ihConf['small']['height']))) {
$this->sizetype = 'small';
} else
$this->sizetype = 'generic';
}
function determine_image_sizetype() {
global $ihConf;
if (!zen_not_null($ihConf['large']['suffix']) {
$ihConf['large']['suffix'] = '_LRG';
}
if (!zen_not_null($ihConf['medium']['suffix']) {
$ihConf['medium']['suffix'] = '_MED';
}
if (strstr($this->src, $ihConf['large']['suffix'])) {
$this->sizetype = 'large';
} elseif (strstr($this->src, $ihConf['medium']['suffix'])) {
$this->sizetype = 'medium';
} elseif ((intval($this->width) == intval($ihConf['small']['width'])) && (intval($this->height) == intval($ihConf['small']['height']))) {
$this->sizetype = 'small';
} else
$this->sizetype = 'generic';
}
Totally Zenned
niccol:
Yeah, but it is probably easier to change the module than change the auto-installer :-) You've got the line number form the errors
[04-Feb-2015 16:25:51 America/Chicago] PHP Warning: strstr(): Empty needle in /home/enignet/public_html/includes/classes/bmz_image_handler.class.php on line 129
>
> You are probably going to do something like this
>
> ```
function determine_image_sizetype() {
global $ihConf;
if (strstr($this->src, $ihConf['large']['suffix'])) {
$this->sizetype = 'large';
} elseif (strstr($this->src, $ihConf['medium']['suffix'])) {
$this->sizetype = 'medium';
} elseif ((intval($this->width) == intval($ihConf['small']['width'])) && (intval($this->height) == intval($ihConf['small']['height']))) {
$this->sizetype = 'small';
} else
$this->sizetype = 'generic';
}
changed to:
function determine_image_sizetype() {
global $ihConf;
$this->sizetype = 'generic';
if($ihConf['large']['suffix'] != '')
{
if (strstr($this->src, $ihConf['large']['suffix'])) {
$this->sizetype = 'large';
}
}
if($ihConf['medium']['suffix'] != '')
{
if (strstr($this->src, $ihConf['medium']['suffix'])) {
$this->sizetype = 'medium';
}
}
if($ihConf['large']['small'] != '')
{
if (strstr($this->src, $ihConf['small']['suffix'])) {
$this->sizetype = 'small';
}
}
}
>
> Off the top of my head and without looking at any of the other areas or consequences.
> **mc12345678:**
>
> I would suggest either of the following two depending on the desired goal. First would be to prevent the error in this section of code, but wouldn't address similar potential problems later on, the second would set the variables in this section of code** but also may still have the issue later**, either way, an example to address the issue and maintain existing functionality. ** The example above appears to lead to all images being the size of the last defined size. **
>
> ```
function determine_image_sizetype() {
global $ihConf;
if (zen_not_null($ihConf['large']['suffix']) && strstr($this->src, $ihConf['large']['suffix'])) {
$this->sizetype = 'large';
} elseif (zen_not_null($ihConf['medium']['suffix']) && strstr($this->src, $ihConf['medium']['suffix'])) {
$this->sizetype = 'medium';
} elseif ((intval($this->width) == intval($ihConf['small']['width'])) && (intval($this->height) == intval($ihConf['small']['height']))) {
$this->sizetype = 'small';
} else
$this->sizetype = 'generic';
}
function determine_image_sizetype() {
global $ihConf;
if (!zen_not_null($ihConf['large']['suffix']) {
$ihConf['large']['suffix'] = '_LRG';
}
if (!zen_not_null($ihConf['medium']['suffix']) {
$ihConf['medium']['suffix'] = '_MED';
}
if (strstr($this->src, $ihConf['large']['suffix'])) {
$this->sizetype = 'large';
} elseif (strstr($this->src, $ihConf['medium']['suffix'])) {
$this->sizetype = 'medium';
} elseif ((intval($this->width) == intval($ihConf['small']['width'])) && (intval($this->height) == intval($ihConf['small']['height']))) {
$this->sizetype = 'small';
} else
$this->sizetype = 'generic';
}
Happy to update this once you guys hash out the details of WHAT update to make..:laugh:
Totally Zenned
:-)
Whatever. There is a typo in my code due copying and pasting but basically they will all work. Lots of ways of skinning a cat.
function determine_image_sizetype() {
global $ihConf;
$this->sizetype = 'generic';
if($ihConf['large']['suffix'] != '')
{
if (strstr($this->src, $ihConf['large']['suffix'])) {
$this->sizetype = 'large';
}
}
if($ihConf['medium']['suffix'] != '')
{
if (strstr($this->src, $ihConf['medium']['suffix'])) {
$this->sizetype = 'medium';
}
}
if($ihConf['small']['suffix'] != '')
{
if (strstr($this->src, $ihConf['small']['suffix'])) {
$this->sizetype = 'small';
}
}
}
And, I am not sure that the first of your two options would prevent the error because if you put :
if (zen_not_null($ihConf['large']['suffix']) && strstr($this->src, $ihConf['large']['suffix']))
The 'strstr' will still always get evaluated. And it is that which is causing the issues. That's why they are nested in my version.
Totally Zenned
niccol:
:-)
Whatever. There is a typo in my code due copying and pasting but basically they will all work. Lots of ways of skinning a cat.
function determine_image_sizetype() {
global $ihConf;
$this->sizetype = 'generic';
if($ihConf['large']['suffix'] != '')
{
if (strstr($this->src, $ihConf['large']['suffix'])) {
$this->sizetype = 'large';
}
}
if($ihConf['medium']['suffix'] != '')
{
if (strstr($this->src, $ihConf['medium']['suffix'])) {
$this->sizetype = 'medium';
}
}
if($ihConf['small']['suffix'] != '')
{
if (strstr($this->src, $ihConf['small']['suffix'])) {
$this->sizetype = 'small';
}
}
}
>
> And, I am not sure that the first of your two options would prevent the error because if you put :
>
> ```
if (zen_not_null($ihConf['large']['suffix']) && strstr($this->src, $ihConf['large']['suffix']))
The 'strstr' will still always get evaluated. And it is that which is causing the issues. That's why they are nested in my version.
This is ME looking confused..:wacko: (as usual) Soooooooooooooooooooooooooooooooooo mom & dad.... Which one do I choose.. (looks at mom... cause she's leaning towards her code..:laugh:)
Totally Zenned
niccol:
:-)
Whatever. There is a typo in my code due copying and pasting but basically they will all work. Lots of ways of skinning a cat.
function determine_image_sizetype() {
global $ihConf;
$this->sizetype = 'generic';
if($ihConf['large']['suffix'] != '')
{
if (strstr($this->src, $ihConf['large']['suffix'])) {
$this->sizetype = 'large';
}
}
if($ihConf['medium']['suffix'] != '')
{
if (strstr($this->src, $ihConf['medium']['suffix'])) {
$this->sizetype = 'medium';
}
}
if($ihConf['small']['suffix'] != '')
{
if (strstr($this->src, $ihConf['small']['suffix'])) {
$this->sizetype = 'small';
}
}
}
>
> And, I am not sure that the first of your two options would prevent the error because if you put :
>
> ```
if (zen_not_null($ihConf['large']['suffix']) && strstr($this->src, $ihConf['large']['suffix']))
The 'strstr' will still always get evaluated. And it is that which is causing the issues. That's why they are nested in my version.
One of the things about php is that in an if statement that has ands, it processes from left to right. When a false is encountered it ditches out and doesn't process the remaining... I chose zen_not_null to stay in line with typical ZC code. If that is not provide a satisfactory result, then would use != '' instead. But it is my understanding that if a variable is provided to zen_not_null that if it is a string = '' it returns false, if it is NULL that is provided it returns false. Either of these two values are expected for nothing being in the configuration setting depending on the mysql setup of allowing thie constant to be null or ''.
Further, the above suggested change of all ifs being evaluated and not one stopping subsequent evaluation when an earlier is identified as being "the one" depends on none of the other variables being set when entering this function. Thus, if all large, medium and small are set, then the result of the series of ifs is that the image will always be identified as small....
I haven't dug back deeper in the code to identify if only one of those is set upon entry into this function, which if not mistaken was also true when either suggestion was made based on previous comment.
Totally Zenned
Totally Zenned
Further, looking into: includes/functions/extra_functions/functions_bmz_image_handler.php, the $ihConf variable is set without discrimination of the requested image size. Therefore all sub variables of $ihConf[size]['suffix'] are assigned, although small is not assigned a value as evidence in the review of the dimensions that is performed in the third elseif...
Fields marked required must be completed.
Tell staff why this post should be reviewed.