If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / All Other Contributions/Addons / ZX Optimized Images [Support Thread]

ZX Optimized Images [Support Thread]

Started by balihr on 6 Jan 2020, 2:35 PM · Views: 2,345

Results 1 to 12 of 12
6 Jan 2020, 2:35 PM
#1
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,819
Plugin Contributions:
24

Post #1 by balihr

Support thread for ZX Optimized Images - a Zen Cart plugin for optimizing images. This plugin will automatically optimize your images, resize it to various dimensions and run it through resmush.it to provide the best possible optimization.

Product images are usually the weak spot when it comes to page load time. If you have large high quality images, one single image can easily be 200-500 kB. Product listing pages can easily get to a few MBs because of the images which means it's slower to load.

This plugin will automatically resize your images to the sizes needed by your site, and will then run each of the resized image through one of the most popular image optimization services available.

Once the images are optimized, all optimized variants are saved to your server and are being loaded automatically based on the size needed. You can easily save several megabytes of data transfer when using optimized images. And, of course, the site will load significantly faster.

Let's not forget search engines will love it!

Attachment 18781 Attachment 18782

If anyone wants to grab it before mods approve it, you can find it here.

Plugin was tested on Zen Cart 1.5.6c, but should work with older versions as well. No idea how far back.

Looking forward to your comments and improvement ideas. I'll do my best to provide support for the module, but can't guarantee anything.

My site - Pro ZC Help
My portfolio | My plugins

15 Jan 2020, 4:58 AM
#3
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Post #3 by ryk

A couple of questions...

  1. What makes this better than IH5?
  2. I see from the documentation that only product images are optimised. Are there any plans to incorporate other images - categories, banners etc?

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

15 Jan 2020, 5:14 AM
#4
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,819
Plugin Contributions:
24

Post #4 by balihr

Ryk:

A couple of questions...

  1. What makes this better than IH5?
    IH uses GD library to resize and compress images, and it's compression is inferior to JPEGoptim, PNGQuant and OptiPNG libraries used by resmush.it. You could install those libraries on your server and build a plugin with server-side optimization, but it wouldn't be this simple.
    I have made a comparison using the same product listing page with IH and ZXOI. You can see the results here. 14% improvement is quite a lot, and images are actually better quality because of the optimization libraries.
  1. I see from the documentation that only product images are optimised. Are there any plans to incorporate other images - categories, banners etc?

Already optimizing. ZXOI basically "hijacks" all images loaded with zen_image() function and runs it through the optimization process. Category and banner images are optimized.

I'm currently working on an admin-side page to batch-run the optimization process and take the stress out of frontend. Should be done in a few days, depending how much free time I manage to find. :smile:

Ideas for improvements are always welcome.

My site - Pro ZC Help
My portfolio | My plugins

15 Jan 2020, 5:17 AM
#5
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Post #5 by ryk

Sounds good. Thanks

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

18 Jan 2020, 6:06 PM
#6
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Post #6 by ryk

Hi Leonard

Fyi Am recieving the following error

[18-Jan-2020 18:00:52 Europe/London] PHP Fatal error: Call to undefined function finfo_open() in /public_html/includes/classes/vendors/imageMagician/php_image_magician.php on line 2643

Have tried on both a ZC155e installation running php5.6 and a ZC156c running php7.3

These seem to be being generated immediately on trying to access any category

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

18 Jan 2020, 10:28 PM
#7
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,819
Plugin Contributions:
24

Post #7 by balihr

Can you check if fileinfo extension is installed on your server? The finfo_open() is a standard php function which is usually enabled, but if it's not, you need to edit your server's config and enable it.

My site - Pro ZC Help
My portfolio | My plugins

19 Jan 2020, 2:52 PM
#8
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,819
Plugin Contributions:
24

Post #8 by balihr

I've just submitter version 1.2.0 and it's awaiting approval. Until approved, you can download it here.

New: admin-side page to run the optimization on all catalog images

Attachment 18807

My site - Pro ZC Help
My portfolio | My plugins

3 Feb 2020, 12:28 PM
#9
mattbough avatar

mattbough

New Zenner

Join Date:
Feb 2015
Location:
UK
Posts:
13
Plugin Contributions:
0

Post #9 by mattbough

Hi,

This is great I have a couple of suggestions though.

Can you put an option to not show optimised image if there isnt a file there? So it doesn't slow down the website whilst images are being optimised?

Can you also handle the file not found error as that has tripped a couple of the runs up on our build.

I keep getting timeouts from our server ( Which i know is from our end not the plugin) but it woudl be good if there is some way to handle this so it shows the last record that has been optimised.

13 Feb 2020, 1:57 PM
#10
meksicus avatar

meksicus

New Zenner

Join Date:
Jul 2015
Location:
Warsaw
Posts:
16
Plugin Contributions:
0

Post #10 by meksicus

Hi there.
Some issues found diring short test :
First - I use more complex directory structure inside image folder, than just flat. I split my images between manufacturers (images/manu-1, images/manu-2, ...) so i can have socks.jpg image in different folders.
Batch compressions from Admin->Tools is using only image name to make new output files, so - in my situation - there will be only one file s/socks-200x200.jpg.

Second - i tried to use this with IH 5.x handler - it generates a lot more file names then just ZX.
As example - after running batch compression from admin i have one s/socks-200x200.jpg file. Than, after going to my product with socks.jpg image, i found additional s/socks-200x200-200x200.jpg image file, which in fact has to be only one. An i see it is generated during product page loading.

Third - ZX makes a subdirs like a, b, c etc ... But there is no umask seting before creating this subfolders. Final effect is, that (on my hosting) subfolders are created with 644 attributes (during product page loading), so ZX cannot write a files after compression - subfolders are empty, no images appears on my website. After manual changing subfolder attributes to 755, everything works fine.

Regards
Marek.

19 Feb 2020, 6:51 PM
#11
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Post #11 by ryk

Hi Leonard

The vast majority of images are showing with an orange X. I can't see any explanation in the documentation so could you explain exactly what it signifies please?

Have they have not been sent to remushit?
Have they been sent but can't be optimnised for some reason?
Are they not accessible to the plugin code?

We had a lot of trouble getting this to work on some sites on which we have built our own templates, and it seemed that the module does not like images where no dimension has been set on height and width, and won't accept 0 values in both. It MUST have a positive value in either height or width.

However, further testing still didn't produce the expected results, and we then found that ZX Optimizer DOES NOT serve images if proportional images are switched off.

Hope that may help others.

Thanks

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

27 Feb 2020, 9:52 PM
#12
stellarweb avatar

stellarweb

Zen Follower

Join Date:
May 2006
Location:
Montana
Posts:
293
Plugin Contributions:
8

Post #12 by stellarweb

When I go to Tools and to optimize the images I get this message: saveImage: This is not a resource.

https://learnaboutfengshui.com
v1.5.6c
PHP 7.0.33

Here is the error log:

[27-Feb-2020 21:49:27 UTC] Request URI: /2019/zx_optimized_images.php, IP address: 174.247.113.94
#1 imagecreatetruecolor() called at [/home/learnabo/public_html/includes/classes/vendors/imageMagician/php_image_magician.php:299]
#2 imageLib->resizeImage() called at [/home/learnabo/public_html/2019/includes/functions/extra_functions/zx_optimized_images.php:85]
#3 zx_optimized_images() called at [/home/learnabo/public_html/2019/zx_optimized_images.php:28]
--> PHP Warning: imagecreatetruecolor(): Invalid image dimensions in /home/learnabo/public_html/includes/classes/vendors/imageMagician/php_image_magician.php on line 299.

[27-Feb-2020 21:49:27 UTC] Request URI: /2019/zx_optimized_images.php, IP address: 174.247.113.94
#1 imagealphablending() called at [/home/learnabo/public_html/includes/classes/vendors/imageMagician/php_image_magician.php:380]
#2 imageLib->keepTransparancy() called at [/home/learnabo/public_html/includes/classes/vendors/imageMagician/php_image_magician.php:300]
#3 imageLib->resizeImage() called at [/home/learnabo/public_html/2019/includes/functions/extra_functions/zx_optimized_images.php:85]
#4 zx_optimized_images() called at [/home/learnabo/public_html/2019/zx_optimized_images.php:28]
--> PHP Warning: imagealphablending() expects parameter 1 to be resource, boolean given in /home/learnabo/public_html/includes/classes/vendors/imageMagician/php_image_magician.php on line 380.

[27-Feb-2020 21:49:27 UTC] Request URI: /2019/zx_optimized_images.php, IP address: 174.247.113.94
#1 imagesavealpha() called at [/home/learnabo/public_html/includes/classes/vendors/imageMagician/php_image_magician.php:381]
#2 imageLib->keepTransparancy() called at [/home/learnabo/public_html/includes/classes/vendors/imageMagician/php_image_magician.php:300]
#3 imageLib->resizeImage() called at [/home/learnabo/public_html/2019/includes/functions/extra_functions/zx_optimized_images.php:85]
#4 zx_optimized_images() called at [/home/learnabo/public_html/2019/zx_optimized_images.php:28]
--> PHP Warning: imagesavealpha() expects parameter 1 to be resource, boolean given in /home/learnabo/public_html/includes/classes/vendors/imageMagician/php_image_magician.php on line 381.

[27-Feb-2020 21:49:27 UTC] Request URI: /2019/zx_optimized_images.php, IP address: 174.247.113.94
#1 imagecolorallocatealpha() called at [/home/learnabo/public_html/includes/classes/vendors/imageMagician/php_image_magician.php:382]
#2 imageLib->keepTransparancy() called at [/home/learnabo/public_html/includes/classes/vendors/imageMagician/php_image_magician.php:300]
#3 imageLib->resizeImage() called at [/home/learnabo/public_html/2019/includes/functions/extra_functions/zx_optimized_images.php:85]
#4 zx_optimized_images() called at [/home/learnabo/public_html/2019/zx_optimized_images.php:28]
--> PHP Warning: imagecolorallocatealpha() expects parameter 1 to be resource, boolean given in /home/learnabo/public_html/includes/classes/vendors/imageMagician/php_image_magician.php on line 382.

[27-Feb-2020 21:49:27 UTC] Request URI: /2019/zx_optimized_images.php, IP address: 174.247.113.94
#1 imagefilledrectangle() called at [/home/learnabo/public_html/includes/classes/vendors/imageMagician/php_image_magician.php:383]
#2 imageLib->keepTransparancy() called at [/home/learnabo/public_html/includes/classes/vendors/imageMagician/php_image_magician.php:300]
#3 imageLib->resizeImage() called at [/home/learnabo/public_html/2019/includes/functions/extra_functions/zx_optimized_images.php:85]
#4 zx_optimized_images() called at [/home/learnabo/public_html/2019/zx_optimized_images.php:28]
--> PHP Warning: imagefilledrectangle() expects parameter 1 to be resource, boolean given in /home/learnabo/public_html/includes/classes/vendors/imageMagician/php_image_magician.php on line 383.

[27-Feb-2020 21:49:27 UTC] Request URI: /2019/zx_optimized_images.php, IP address: 174.247.113.94
#1 imagecopyresampled() called at [/home/learnabo/public_html/includes/classes/vendors/imageMagician/php_image_magician.php:301]
#2 imageLib->resizeImage() called at [/home/learnabo/public_html/2019/includes/functions/extra_functions/zx_optimized_images.php:85]
#3 zx_optimized_images() called at [/home/learnabo/public_html/2019/zx_optimized_images.php:28]
--> PHP Warning: imagecopyresampled() expects parameter 1 to be resource, boolean given in /home/learnabo/public_html/includes/classes/vendors/imageMagician/php_image_magician.php on line 301.