Post by tingwing » Sat Aug 14, 2021 10:19 am

hi
just now ,i found the the folder "image/cache" is over 11G, which i think is too big,as the other part of the website is 2G.
how to stop it become too big?
or is it possible to disable the cache function?

if delete all images in "image/cache" ,they will come back a few days later.
if chmod 555 cache ,the product images will not show at category page
by the way ,i have set "dashboard-the right top gear-theme/sass off",hope it will help.


thanks
Last edited by tingwing on Wed Aug 18, 2021 11:26 am, edited 2 times in total.

my extension:https://www.opencart.com/index.php?rout ... estshop24h
email :support@bestshop24h.com
site:http://www.bestshop24h.com


Active Member

Posts

Joined
Tue Aug 02, 2016 9:01 pm

Post by ADD Creative » Sat Aug 14, 2021 7:20 pm

How many different sizes of each image do you have? Can you cut down on the number of sizes used by your theme?

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by thekrotek » Sat Aug 14, 2021 7:29 pm

Looks like you have tons of images and every image is saved in different sized in cache folder, which increases the overall folder size correspondingly. If you have some skills, you can try to make the image resizing feature work differently on your site, but this will require a bunch of work.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by JNeuhoff » Sat Aug 14, 2021 7:51 pm

Even with all the cached re-sized image versions of the original ones the client web browser will still dynamically resize them again on many occasions. This is because of using a responsive web theme. Therefore, the easiest way to bypass the image/cache is to only use the original images, be modifying the catalog/model/tool/image.php as follows:

Code: Select all

<?php
class ModelToolImage extends Model {
	public function resize($filename, $width, $height) {
		if (!is_file(DIR_IMAGE . $filename) || substr(str_replace('\\', '/', realpath(DIR_IMAGE . $filename)), 0, strlen(DIR_IMAGE)) != str_replace('\\', '/', DIR_IMAGE)) {
			return;
		}
		/* don't resize, keep using the original image, it's a responsive web theme anyway! */
		return $filename;
	}
}

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member
Online

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by thekrotek » Sat Aug 14, 2021 8:35 pm

JNeuhoff wrote:
Sat Aug 14, 2021 7:51 pm
Even with all the cached re-sized image versions of the original ones the client web browser will still dynamically resize them again on many occasions. This is because of using a responsive web theme. Therefore, the easiest way to bypass the image/cache is to only use the original images, be modifying the catalog/model/tool/image.php as follows:
Yeah and in the end you will have a 1280x720 images in the products list of the cart as well as in any other place. This task requires at least a bunch of CSS tweaks whenever you have an image. Let alone, it will load original images for EVERY thumbnail, which isn't very wise.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by JNeuhoff » Sat Aug 14, 2021 8:49 pm

@thekrotek: Fair point, especially if the original image is quite big.

In practice, we never use images like 1280x720. An image that size would almost fill the whole screen area on most devices.

Using an excessive amount of additional product images for a product is often unnecessary and not good for the site performance. There are things you can do for the client-side browsers, such as lazy-image loading, or client-side image caching. Get the original images down to a more realistic sizes.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member
Online

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by by mona » Mon Aug 16, 2021 7:55 am

Your site uses the images from the cache, those are resized images, your original images are only used for creating those unless the target dimensions are exactly the same as the original.

For products alone, the size of your cache folder depends on
1) how many original images you have defined for your products
2) how well your originals have been optimized
3) how many different dimensions you have defined (max 10)
4) how big those dimensions are.

You can delete those cached images but they will be recreated on page request which will slow down that request enormously depending on the amount of product images on the page, resizing images on the fly is a bad idea.
Not resizing the images but instead using the original for all types is also not a good idea, on category pages you will be sending huge amounts of data needlessly.
Of course those images will be browser cached but that cache will only take so much before it flushes.

If you frequently change the dimensions in admin, it will not remove the old images from the cache so you may have some old images in there taking up needless space. So do not change the dimensions too often and if you do, clear out the cache afterwards and run a local spider to re-generate the images beforehand so the customers do not have to during their requests.

If you think 11GB is too big (I don't) you may look at perhaps optimizing your image sizes and using the same dimensions for different types in admin.

PS. SASS has nothing to do with images.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by paulfeakins » Mon Aug 16, 2021 6:53 pm

tingwing wrote:
Sat Aug 14, 2021 10:19 am
just now ,i found the the folder "image/cache" is over 11G, which i think it is too big,
How big is image folder after you delete the cached files?

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 tingwing » Wed Aug 18, 2021 11:30 am

paulfeakins wrote:
Mon Aug 16, 2021 6:53 pm
tingwing wrote:
Sat Aug 14, 2021 10:19 am
just now ,i found the the folder "image/cache" is over 11G, which i think it is too big,
How big is image folder after you delete the cached files?
it is less than 2G

my extension:https://www.opencart.com/index.php?rout ... estshop24h
email :support@bestshop24h.com
site:http://www.bestshop24h.com


Active Member

Posts

Joined
Tue Aug 02, 2016 9:01 pm

Post by tingwing » Thu Dec 02, 2021 6:00 pm

by mona wrote:
Mon Aug 16, 2021 7:55 am


If you frequently change the dimensions in admin, it will not remove the old images from the cache so you may have some old images in there taking up needless space. So do not change the dimensions too often and if you do, clear out the cache afterwards and run a local spider to re-generate the images beforehand so the customers do not have to during their requests.

If you think 11GB is too big (I don't) you may look at perhaps optimizing your image sizes and using the same dimensions for different types in admin.

thanks so much!

my extension:https://www.opencart.com/index.php?rout ... estshop24h
email :support@bestshop24h.com
site:http://www.bestshop24h.com


Active Member

Posts

Joined
Tue Aug 02, 2016 9:01 pm
Who is online

Users browsing this forum: integraa and 268 guests