Zen Cart Logo
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

Sticky

Views: 159,057

Results 21 to 40 of 765
10 Nov 2017, 4:26 PM
#21
lat9 avatar

lat9

Administrator

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

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

Image Handler 5, v5.0.0, has been submitted to the Zen Cart plugins for review. When approved, it can be downloaded from https://www.zen-cart.com/downloads.php?do=file&id=2169. I'll update this thread when the plugin's download is available.

21 Nov 2017, 12:56 PM
#22
lat9 avatar

lat9

Administrator

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

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

lat9:

Image Handler 5, v5.0.0, has been submitted to the Zen Cart plugins for review. When approved, it can be downloaded from https://www.zen-cart.com/downloads.php?do=file&id=2169. I'll update this thread when the plugin's download is available.
IH5 is now available for download from the Zen Cart plugins!

30 Nov 2017, 1:45 PM
#23
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,845
Plugin Contributions:
0

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

Update from IH4 is not clear in the instructions. We run the IH4 uninstall, then we upload IH5 files, refresh admin. That seems to only get us two of the settings in the configuration>images. To fully install I need to go into the database and remove the version number row and refresh the admin and then we get a full install. Seems that the IH4 uninstall doesn't remove the version number, so IH5 install only runs and upgrade... Are we supposed to not run the IH4 uninstall first?

30 Nov 2017, 2:16 PM
#24
lat9 avatar

lat9

Administrator

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

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

barco57:

Update from IH4 is not clear in the instructions. We run the IH4 uninstall, then we upload IH5 files, refresh admin. That seems to only get us two of the settings in the configuration>images. To fully install I need to go into the database and remove the version number row and refresh the admin and then we get a full install. Seems that the IH4 uninstall doesn't remove the version number, so IH5 install only runs and upgrade... Are we supposed to not run the IH4 uninstall first?
I'll need to re-test, now that you've brought it up, but I'm pretty sure that IH5 updates directly from IH4 ... no uninstall required.

4 Jan 2018, 6:26 PM
#25
brittainmark avatar

brittainmark

Totally Zenned

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

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

Love this Plug in. Might I be so bold as to suggest a change to how you Determin the folder under bmz_cache that you put the item into. As you suggest I place my picture into subfolders of the main folder for my products. Unfortuatly I name my items starting with the 2 digit year and as I have many individual items using the current method if I donot use the "Hashed" method they all go into the same folder. I beleive that the following would place them into the same folder under bmz_cache as they are in my images section. The sugested change needs to be made to include\functions\extra_functions\functions_bmz_io.php

function getCacheName($data, $ext='') 
{
	if (IH_CACHE_NAMING == 'Hashed') {
       $md5  = (IH_CACHE_NAMING == 'Hashed') ? md5($data) : $data;
       $file = $GLOBALS['bmzConf']['cachedir'] . '/' . $md5{0} . '/' . $md5 . $ext;
	}
    else {
    	$md5  =  $data;
    	$filepos = strpos($md5,"-");
    	$filepos = ($filepos===false) ? 1 : $filepos ;
    	$file = $GLOBALS['bmzConf']['cachedir'] . '/' .substr($md5,0,$filepos). '/' . $md5 . $ext;
    }
    io_makeFileDir($file);
    return $file;
}

I will understand if you do not want to make the change. In the mean time I will continue to used hashed to keep the images under control.

11 Jan 2018, 3:35 PM
#27
soxophoneplayer avatar

soxophoneplayer

Totally Zenned

Join Date:
Feb 2008
Posts:
534
Plugin Contributions:
0

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

I'm in process up updating from zc 1.5.5e to 1.5.5f. Using Responsive Sheffield Blue 2.0. In 1.5.5e I was using older Colorbox that was part of RSB template, and IH4. All worked. As part of updating to 1.5.5f I want to update those two mods. I stripped out both completely and removed any residual tables in the db the were left behind after uninstall.

I then added Zen Colorbox 2, most recent download. Now I'm in process of adding IH5. One snag I've hit - in includes/modules/Your Template/additional_images there is a piece if Colorbox modification to the file at the same location that IH5 modifies the same file. I note that the file included in the Colorbox 2 set has IH4 modifications in it as well so I presume I would merge in favour of the IH5 file, but don't know where (of if) to place the bit of Colorbox 2 code.

First sample below is from the Colorbox file and the lower is from the IH5 file.

Thanks for any help.

   // Link Preparation:
    // bof Zen Colorbox 2012-04-30 niestudio
    if(function_exists('zen_colorbox')){
      include 'zen_colorbox.php';
    } else {
    $script_link = '<script type="text/javascript"><!--' . "\n" . 'document.write(\'' . ($flag_display_large ? '<a href="javascript:popupWindow(\\\'' . str_replace($products_image_large, urlencode(addslashes($products_image_large)), $large_link) . '\\\')">' . $thumb_slashes . '<br />' . TEXT_CLICK_TO_ENLARGE . '</a>' : $thumb_slashes) . '\');' . "\n" . '//--></script>';
    }
    // eof Zen Colorbox 2012-04-30 niestudio
        // Link Preparation:
//-bof-image_handler-lat9  *** 4 of 4 ***
        // -----
        // This notifier gives notice that an additional image's script link is requested.  A monitoring observer sets
        // the $p2 value to boolean true if it has provided an alternate form of that link; otherwise, the base code will
        // create that value.
        //
        // $p1 ... (r/o) ... An associative array, containing the 'flag_display_large', 'products_name', 'products_image_large' and 'thumb_slashes' values.
        // $p2 ... (r/w) ... A reference to the $script_link value, set here to boolean false; if an observer modifies that value, the
        //                     this module's processing is bypassed.
        //
        $script_link = false;
        $zco_notifier->notify(
            'NOTIFY_MODULES_ADDITIONAL_IMAGES_SCRIPT_LINK',
            array(
                'flag_display_large' => $flag_display_large,
                'products_name' => $products_name,
                'products_image_large' => $products_image_large,
                'thumb_slashes' => $thumb_slashes
            ),
            $script_link
        );
        if ($script_link === false) {
            $script_link = '<script type="text/javascript"><!--' . "\n" . 'document.write(\'' . ($flag_display_large ? '<a href="javascript:popupWindow(\\\'' . str_replace($products_image_large, urlencode(addslashes($products_image_large)), $large_link) . '\\\')">' . $thumb_slashes . '<br />' . TEXT_CLICK_TO_ENLARGE . '</a>' : $thumb_slashes) . '\');' . "\n" . '//--></script>';
        }
//-eof-image_handler-lat9  *** 4 of 4 ***
11 Jan 2018, 3:51 PM
#28
lat9 avatar

lat9

Administrator

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

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

soxophoneplayer:

I'm in process up updating from zc 1.5.5e to 1.5.5f. Using Responsive Sheffield Blue 2.0. In 1.5.5e I was using older Colorbox that was part of RSB template, and IH4. All worked. As part of updating to 1.5.5f I want to update those two mods. I stripped out both completely and removed any residual tables in the db the were left behind after uninstall.

I then added Zen Colorbox 2, most recent download. Now I'm in process of adding IH5. One snag I've hit - in includes/modules/Your Template/additional_images there is a piece if Colorbox modification to the file at the same location that IH5 modifies the same file. I note that the file included in the Colorbox 2 set has IH4 modifications in it as well so I presume I would merge in favour of the IH5 file, but don't know where (of if) to place the bit of Colorbox 2 code.

First sample below is from the Colorbox file and the lower is from the IH5 file.

Thanks for any help.

// Link Preparation:
// bof Zen Colorbox 2012-04-30 niestudio
if(function_exists('zen_colorbox')){
include 'zen_colorbox.php';
} else {
$script_link = '<script type="text/javascript"><!--' . "\n" . 'document.write(\'' . ($flag_display_large ? '<a href="javascript:popupWindow(\\\'' . str_replace($products_image_large, urlencode(addslashes($products_image_large)), $large_link) . '\\\')">' . $thumb_slashes . '<br />' . TEXT_CLICK_TO_ENLARGE . '</a>' : $thumb_slashes) . '\');' . "\n" . '//--></script>';
}
// eof Zen Colorbox 2012-04-30 niestudio

> 
> ```
        // Link Preparation:
//-bof-image_handler-lat9  *** 4 of 4 ***
        // -----
        // This notifier gives notice that an additional image's script link is requested.  A monitoring observer sets
        // the $p2 value to boolean true if it has provided an alternate form of that link; otherwise, the base code will
        // create that value.
        //
        // $p1 ... (r/o) ... An associative array, containing the 'flag_display_large', 'products_name', 'products_image_large' and 'thumb_slashes' values.
        // $p2 ... (r/w) ... A reference to the $script_link value, set here to boolean false; if an observer modifies that value, the
        //                     this module's processing is bypassed.
        //
        $script_link = false;
        $zco_notifier->notify(
            'NOTIFY_MODULES_ADDITIONAL_IMAGES_SCRIPT_LINK',
            array(
                'flag_display_large' => $flag_display_large,
                'products_name' => $products_name,
                'products_image_large' => $products_image_large,
                'thumb_slashes' => $thumb_slashes
            ),
            $script_link
        );
        if ($script_link === false) {
            $script_link = '<script type="text/javascript"><!--' . "\n" . 'document.write(\'' . ($flag_display_large ? '<a href="javascript:popupWindow(\\\'' . str_replace($products_image_large, urlencode(addslashes($products_image_large)), $large_link) . '\\\')">' . $thumb_slashes . '<br />' . TEXT_CLICK_TO_ENLARGE . '</a>' : $thumb_slashes) . '\');' . "\n" . '//--></script>';
        }
//-eof-image_handler-lat9  *** 4 of 4 ***

Unless something has drastically changed in the ColorBox plugin, you should use the version of the file distributed by IH5. That will cause the ColorBox observer-class also distributed by IH5 to take control at the appropriate spot.

11 Jan 2018, 7:55 PM
#29
soxophoneplayer avatar

soxophoneplayer

Totally Zenned

Join Date:
Feb 2008
Posts:
534
Plugin Contributions:
0

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

lat9:

Unless something has drastically changed in the ColorBox plugin, you should use the version of the file distributed by IH5. That will cause the ColorBox observer-class also distributed by IH5 to take control at the appropriate spot.

Done and done. Thankyou.

FYI - I did have same issue as in post #23 above, and used same fix.

11 Jan 2018, 8:15 PM
#30
lat9 avatar

lat9

Administrator

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

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

soxophoneplayer:

Done and done. Thankyou.

FYI - I did have same issue as in post #23 above, and used same fix.
Thanks for the follow-up; I'll see what's going on in that upgrade scenario, too.

22 Jan 2018, 2:40 PM
#31
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

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

Hi
This is a general question:
Is there a simple way to get the IH image ?
Asking this, because I doing a autocomplete search box and if possible, it would be best to use already resized images.
I'm following the admin image_handler page, but I guess that's for comparing , etc...

Thanks

22 Jan 2018, 4:22 PM
#32
lat9 avatar

lat9

Administrator

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

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

mesnitu:

Hi
This is a general question:
Is there a simple way to get the IH image ?
Asking this, because I doing a autocomplete search box and if possible, it would be best to use already resized images.
I'm following the admin image_handler page, but I guess that's for comparing , etc...

Thanks
Is this for a storefront or admin search box?

22 Jan 2018, 4:33 PM
#33
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

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

In this case Store front

thanks

22 Jan 2018, 4:38 PM
#34
lat9 avatar

lat9

Administrator

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

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

That one's easy, then! When you call the zen_image() function and have IH loaded and enabled, that function (in turn) calls the IH function to handle that image. Net/net, that's the way to get a resized/cached version of the image.

22 Jan 2018, 5:14 PM
#35
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

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

Thanks
So I guess the other one it's difficult,... and that's the one I need. I didn't explain myself. The autocomplete is for the store front, but ,(still testing) I'm creating a json file in the admin area, so it's there that I need to get the IH (small) image path.

22 Jan 2018, 5:24 PM
#36
lat9 avatar

lat9

Administrator

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

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

mesnitu:

Thanks
So I guess the other one it's difficult,... and that's the one I need. I didn't explain myself. The autocomplete is for the store front, but ,(still testing) I'm creating a json file in the admin area, so it's there that I need to get the IH (small) image path.
The admin-side is a bit more complicated, since that version of the zen_image function doesn't look for/use the IH-supplied re-formatting. Which type of Cache File-Naming Convention are you using?

22 Jan 2018, 5:33 PM
#37
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

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

lat9:

Which type of Cache File-Naming Convention are you using?

That's a IH5 feature right ? I'm still using IH4, but I intend to move to IH5, but I didn't had the time yet.

Perhaps I shod upgrade first and ask later ... is this stable now ?

22 Jan 2018, 6:22 PM
#38
lat9 avatar

lat9

Administrator

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

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

mesnitu:

That's a IH5 feature right ? I'm still using IH4, but I intend to move to IH5, but I didn't had the time yet.

Perhaps I shod upgrade first and ask later ... is this stable now ?
The GitHub repository is in a bit of flux, but the released version is stable. Since you're using IH4, you're using the hashed version of the cache file naming.

I'd recently looked this up for a client, so here's the process, assuming that you're using the IH-4/5 default settings.

  1. Take the products_image definition from the products table in the database, let's call this $products_image.
  2. Prepend that value with the images' directory: $image_source = DIR_WS_IMAGES . $products_image;
  3. Append that value with the default settings: $image_source .= ('85' . '255:255:255' . 'Center');
  4. Create an md5-hash of that value: $cache_filename = md5($image_source);

That $cache_filename now contains the *filename *portion associated with the cached image. Images are stored in the /bmz_cache/$cache_filename[0]/$cache_filename.image.$dimensions.$extension, where $dimensions = $width . 'x' . $height (of the image) and $extension is the image-file's base extension.

That description's probably a bit muddy; just post back if you have additional questions.

22 Jan 2018, 8:27 PM
#39
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

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

Thank you! I'll be looking if I can do this.
It would be a nice addition to IH.
Recently I made some changes how to handle images with ep4bookx ( import addition to deal with bookx product type using EP4).
And basically, it allows to rename, resize, download books images or authors images from a temp folder, to the destination folders.
I had to search for some script to use GD, since I didn't manage to use IH. ( maybe my fault).
Another thing that I'm planing to do, is to create export newsletter to MailChimp ( html format).
And it would be nice to use IH.
What I'm trying to say, is that IH could be a "library" to image handling, globally.
But, I do understand the amount of work and that somebody has to pay the bills.
Thanks

23 Jan 2018, 5:16 AM
#40
mc12345678 avatar

mc12345678

Totally Zenned

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

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

mesnitu:

Thank you! I'll be looking if I can do this.
It would be a nice addition to IH.
Recently I made some changes how to handle images with ep4bookx ( import addition to deal with bookx product type using EP4).
And basically, it allows to rename, resize, download books images or authors images from a temp folder, to the destination folders.
I had to search for some script to use GD, since I didn't manage to use IH. ( maybe my fault).
Another thing that I'm planing to do, is to create export newsletter to MailChimp ( html format).
And it would be nice to use IH.
What I'm trying to say, is that IH could be a "library" to image handling, globally.
But, I do understand the amount of work and that somebody has to pay the bills.
Thanks

Umm... Do you need just the filename or do you need the html <img> tag that provides the image? (or even from that to pull the filename?) If you use the zen_image function to return the generated value, then you will receive the html tag that should contain all that is necessary to display the image. If it is the directory path only needed then the string can be parsed from the content (src parameter), if it is an image tag, then it is the entire returned value from the function.