Post by v200 » Fri Feb 21, 2020 7:16 pm

Hello,
Does anyone know how to disable the image cache in OpenCart v3 ? How I can serve images directly from their /image/ locations, not from /image/cache?
Thank you very much.

New member

Posts

Joined
Thu Jun 06, 2019 3:54 am

Post by IP_CAM » Fri Feb 21, 2020 10:28 pm

There is no such function by OC Default, it would require
a massive rewrite of the Software, to make such work.
Ernie

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

Post by pprmkr » Fri Feb 21, 2020 10:42 pm

No massive rewrite !
Simple return filename instead of resizing and storing in cache:
On line 7 of catalog/model/tool/image.php add:

Code: Select all

		if ($this->request->server['HTTPS']) {
			return $this->config->get('config_ssl') . 'image/' . $filename;
		} else {
			return $this->config->get('config_url') . 'image/' . $filename;
		}
Note: images will show in original size. no more thumbs and popups are generated !

User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by letxobnav » Sat Feb 22, 2020 12:39 am

How I can serve images directly from their /image/ locations
That is a dumb idea.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by v200 » Mon Feb 24, 2020 4:09 am

letxobnav wrote:
Sat Feb 22, 2020 12:39 am
How I can serve images directly from their /image/ locations
That is a dumb idea.
Why do you think that?

New member

Posts

Joined
Thu Jun 06, 2019 3:54 am

Post by IP_CAM » Mon Feb 24, 2020 4:34 am

no more thumbs and popups are generated !
Partly WRONG!

If your Site uses 'Originals', especially in Listing Sections, where those images
are to be shrinked to the Size as declared in Admin, and depending on images
size and image-data-size, your Shop Pages will load very slowly.

And by uploading images trough Admin, the admin image routine file will still
generate it's images in the image/cache/... Section, and depending on
the amount of images you use, and the products you change/replace/add, one day,
your Server could refuse to further work, due to the masses of never ever used files. :laugh:

The answer you got therefore only told you half of the story. It takes more than just
replacing the content of the File mentioned, and requires STRICT sizing of images before
uploading them to a Server, or you will end up in frustration only.

Ernie

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

Post by straightlight » Mon Feb 24, 2020 6:10 am

v200 wrote:
Mon Feb 24, 2020 4:09 am
letxobnav wrote:
Sat Feb 22, 2020 12:39 am
How I can serve images directly from their /image/ locations
That is a dumb idea.
Why do you think that?
If you take a look in the catalog/controller/mail/order.php file:

Code: Select all

$data['logo'] = $order_info['store_url'] . 'image/' . $this->config->get('config_logo');
This will give you an idea. However, it would also be correct to state that using this method to upload images is definitely not the best idea. I have posted a workaround on Github Opencart's Pull Request today. Hopefully, this idea will be added since there are other ways to consider than using a static path for security reasons while there's already a dynamic image path that can be used from both config.php files.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by letxobnav » Mon Feb 24, 2020 12:52 pm

Why do you think that?
Because the cache holds various versions of the original image serving various purposes, resized and optimized.
If you serve the originals:
1) you would have to resize and optimize them yourself which is a pain and end up with the same result just in the original directory
2) use the same image for all purposes which looks terrible or slows the browser down when browser resized.
3) have OC do resizing and optimizing "on-the-fly" which slows you down on the server side.

There are absolutely no positives to this idea, only negatives, so yeah, dumb.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by paulfeakins » Mon Feb 24, 2020 6:54 pm

v200 wrote:
Fri Feb 21, 2020 7:16 pm
Does anyone know how to disable the image cache in OpenCart v3 ? How I can serve images directly from their /image/ locations, not from /image/cache?
As others have said, it's probably not a good idea but it would be worth you telling us why you want to do it?

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 v200 » Mon Feb 24, 2020 9:35 pm

Thank you all. I want to do this because the quality of the photos is very terrible, when they converted to the cache folder. I also have about 50 thousand photos uploaded, but because of the cache folder I have created about 150 thousand. What can I do then?

New member

Posts

Joined
Thu Jun 06, 2019 3:54 am

Post by IP_CAM » Mon Feb 24, 2020 9:57 pm

Well, for only 1 US Cent per image, someone will help you, I guess ... :laugh:

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

Post by letxobnav » Mon Feb 24, 2020 10:02 pm

The quality of the images is based on the original, the quality setting while saving and whether or not they are browser resized.
You have no issue with uploading 50K originals so what is the issue with 150K images in the cache?
If you think that is too much for one directory, split the originals over several directories and the cache will mirror that.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by paulfeakins » Mon Feb 24, 2020 10:10 pm

v200 wrote:
Mon Feb 24, 2020 9:35 pm
I want to do this because the quality of the photos is very terrible, when they converted to the cache folder.
The answer is not to avoid the cache, it's to improve the quality of the cache.

This has been asked lots of times, including here:
viewtopic.php?t=201372

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
Who is online

Users browsing this forum: No registered users and 94 guests