Post by exit15 » Thu Oct 05, 2017 5:09 pm

I have over 100,000 images, 5 images per product which brings the original images count to 500,000. By the time the system creates 5 new images sizes and copies them into the /httpdocs/image/cache/catalog/ directory I end up with 3,000,000 images. The original images are all optimized in terms of disk size so that caching does not really lower the kb size of the image. My theme (Journal2) resizes images on the fly anyway to match the size of the screen, so what is the point of creating all these images sizes 150x150, 250x250, 500x500, etc.?

Can someone offer a solution that will result in the following: Make every product image call use only the original image, the one from the image/catalog/ directory, never from the image/cache/catalog directory. And needless to say, just stop creating all the useless 150x150.jpg, 250x250.jpg, 500x500.jpg, etc. copies.

Using version 2.0.3.1

New member

Posts

Joined
Sun Mar 03, 2013 2:05 am


Post by paulfeakins » Thu Oct 05, 2017 5:52 pm

exit15 wrote:
Thu Oct 05, 2017 5:09 pm
My theme (Journal2) resizes images on the fly anyway to match the size of the screen, so what is the point of creating all these images sizes 150x150, 250x250, 500x500, etc.?
You're right that if Journal makes its own image cache of different sizes it should be ok to disable the OpenCart one, but I doubt it resizes each one "on-the-fly" as you say as that would cause massive server load.

Are you running out of space on your web server?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by exit15 » Fri Oct 06, 2017 12:42 am

Yes I am running out of my 120 GB disk space, but this is a secondary problem. Why on earth should we waste crating an image for example, the additional images size xyz_250x250.jpg, when in reality the responsive theme uses that image as the original and adjusts the size in the browser depending on the size of the screen. Just use the Chrome inspect tool to see what's happening. Here's an example where the 250x250 is being displayed as 148.75px.

Code: Select all

<a class="swiper-slide swiper-slide-next" style="width: 148.75px; margin-right: 10px;" href="http://www.searchwellness.com/image/cache/catalog/goldengulf/goldengulf-4-600x600.jpg" title=""><img src="http://www.searchwellness.com/image/cache/catalog/goldengulf/goldengulf-4-250x250.jpg" title="" alt="" itemprop="image"></a>  
Anyway, while I think its important to set the size of the main image, additional image, cart image, etc in OpenCart' store settings, it should only be used to determine the layout of the page, not create images that are never used as prescribed.

So what I would like to find out if there is a way to simply 1. not create any copies of images, 2. Only load the original image from the main catalog directory in this case

Code: Select all

http://www.searchwellness.com/image/catalog/goldengulf/goldengulf-4.jpg

New member

Posts

Joined
Sun Mar 03, 2013 2:05 am


Post by IP_CAM » Fri Oct 06, 2017 2:31 am

Well, you could create an OcMod, and use Routines, like shown below, to change the
image/cache/ path/link to the image/catalog/ path/link, to so address the original images.
This, by fully ignoring the OC-SET image Size, the image would be shown, as it comes by default.
I have the idea from here, and I use direct image Access in all my test Shops on the Product Page,
to display the original image in Large Image View:
http://www.ebikes.li/shop/index.php?rou ... uct_id=537
---
https://www.opencart.com/index.php?rout ... n_id=20777
---
But the 100x100px size limited thumbs should eventually better be left, as they are OC-linked, I assume,
or then, they need to be custom-sized on the corresponding xxx.tpl File, to KEEP the Style of the Page!
I just added the routines, to show, where it would have to be done ... :D
Just an Idea, but it's fully untested, I could not, since I use no OC v.2...
Good Luck ! ;)
Ernie
---
OcMod Code Snippets:

Code: Select all

<search><![CDATA[
$data['thumb'] = $this->model_tool_image->resize($product_info['image'], $this->config->get($this->config->get('config_theme') . '_image_popup_width'), $this->config->get($this->config->get('config_theme') . '_image_popup_height'));
]]></search>
<add position="replace"><![CDATA[
$data['thumb'] = 'image/' . $product_info['image'];
]]></add>
----
<search><![CDATA[
$data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get($this->config->get('config_theme') . '_image_category_width'), $this->config->get($this->config->get('config_theme') . '_image_category_height'));
]]></search>
<add position="replace"><![CDATA[
$data['thumb'] = 'image/' . $category_info['image'];
]]></add>
---
<search><![CDATA[
$data['thumb'] = $this->model_tool_image->resize($category_info['image'], 100, 100);
]]></search>
<add position="replace"><![CDATA[
$data['thumb'] = 'image/' . $category_info['image'];
]]></add>
---
<search><![CDATA[
$data['thumb'] = $this->model_tool_image->resize($product_info['image'], 100, 100);
]]></search>
<add position="replace"><![CDATA[
$data['thumb'] = 'image/' . $product_info['image'];
]]></add>
You can find the Code in your controller/... Sections, in files like
product.php / category.php / e.t.c. , just in case! :D

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 37 guests