Disabling or limiting thumbnail generation in Phoca Cart

Phoca Cart - complex e-commerce extension
keep2000
Phoca Enthusiast
Phoca Enthusiast
Posts: 89
Joined: 14 Nov 2022, 12:04

Disabling or limiting thumbnail generation in Phoca Cart

Post by keep2000 »

Hey,
I'm just getting familiar with Phoca Cart and noticed that the system stores each image in four versions: the original one plus S, M and L thumbnails.
In my case there are around 20,000 products with roughly 60,000 images, which means over 240,000 files in total.

For the frontend I’m using YOOtheme Pro + PCuikit, which already generates its own optimized responsive images.
So as far as I understand, those Phoca thumbnails are not really needed for the frontend (since YOOtheme handles optimization and srcset generation automatically).
However, I can see that the thumbnails are used in the admin area (e.g. product list previews).

I was wondering — would it be possible to disable thumbnail generation, or maybe generate only one size (like the small one)?

I noticed that there’s an internal enable_thumb_creation parameter in the code, but it’s not exposed in the component config.
As a quick workaround, I managed to disable it completely using my custom system plugin:

Code: Select all

public function onAfterInitialise() {
  \PhocacartUtils::getComponentParameters()->set('enable_thumb_creation', 0);
}

That works fine, but obviously turns off all thumbnail creation.

So my question is:
Is there any way to disable only some of the sizes (e.g. keep S but skip M and L)?
Or maybe a fallback mechanism where, if no thumbnail exists, Phoca Cart just uses the original image (even if that means wblury image), or perhaps generates the missing and neccessary thumbnails on the fly?

Thanks a lot
keep2000
Phoca Enthusiast
Phoca Enthusiast
Posts: 89
Joined: 14 Nov 2022, 12:04

Re: Disabling or limiting thumbnail generation in Phoca Cart

Post by keep2000 »

Maybe an on-the-fly generation using onPCAonImageGetThumbnailName or similar?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49111
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Disabling or limiting thumbnail generation in Phoca Cart

Post by Jan »

Hi, for now there is no such options as the thumbnails are used on different places - all - small, medium or large - it is similar mechanism like in Phoca Gallery - just to save traffic costs with displaying thumbnails instead of large images. :idea:

Jan
If you find Phoca extensions useful, please support the project
keep2000
Phoca Enthusiast
Phoca Enthusiast
Posts: 89
Joined: 14 Nov 2022, 12:04

Re: Disabling or limiting thumbnail generation in Phoca Cart

Post by keep2000 »

Hello,
On my hosting accounts there are limits for both storage size and file count, and since I manage multiple sites on a shared hosting, it’s easy to hit those limits.
Since YOOtheme Pro already handles resized cache images quite nicely on its own, I really don’t need the M and L sizes at all — maybe only the S size, for example in the admin area or the checkout.
For now, I’ve worked around it by disabling thumbnail generation through my own system plugin, and with a small modification to the n3t PhocaCart Console plugin, I only generate the S size. It’s not perfect, but it works well enough for me :)
Post Reply