Post by Joe1234 » Thu Mar 14, 2024 1:41 pm

How exactly do I point my images to a cdn? I setup a cloudfront cdn and structured the bucket (file/dir setup) just like my server, then I changed my image config setting to the base url that I use to bring up an image on the browser :

Code: Select all

define('DIR_IMAGE', 'https://bucket.s3.amazonaws.com/image/');
But it isn't working, when I look at the page source I'm seeing some cryptic img url source like:

Code: Select all

<img src="data:image/png;base64,..............uiusia">
What is the secret? NOTE: All my files are stored on the CDN bucket, and I have htaccess turned off while I set this up so no type of server configs should be interfering.
Thanks

v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by ADD Creative » Thu Mar 14, 2024 9:05 pm

DIR_IMAGE is for a local directory not a remote URL. OpenCart doesn't really support CDN since about version 1.5.4. After which HTTP_IMAGE was removed form the config.php.

Have a look in catalog/model/tool/image.php where most but not all image URLs are generated.

www.add-creative.co.uk


Guru Member

Posts

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

Post by paulfeakins » Thu Mar 14, 2024 11:09 pm

Joe1234 wrote:
Thu Mar 14, 2024 1:41 pm
How exactly do I point my images to a cdn?
Why not use Cloudflare?

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


User avatar
Legendary Member
Online

Posts

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

Post by Joe1234 » Sun Mar 17, 2024 1:13 am

I have it working now for the most part, at least with the images. The site is pulling directly from the S3 bucket. I'm just having a little difficulty with the css and js. I don't know if it's because of the theme, or how they are gathered and then displayed, but they are duplicating. One coming from the cdn, the other coming from my site with an "Other" initiator in the dev console. I want to take a look at the addstyles, addscripts, getstyles, getscripts functions in OC but I can't find them. Where are they located?

@paul, why do you ask? If it's because you are going to point me to the cloudflare extension, I just don't pay for things that I think I can build myself that don't require excessive coding. If it's just curiosity in why I chose this over cloudflare, their free service is a little more clear in what I'm getting in trying it out, and has more leeway until I figure out what's what. It seemED to have more than enough bandwidth to handle production traffic without running into an issue while I test, while cloudflare's bandwidth wasn't clear. But as I'm typing this I decided to google cloudflare instead of reading their site, and it seems they are unlimited in their bandwidth. But for right now I will stick with cloudfront since I have the connection up and running and all files loaded up.

As of now I'm really not seeing a worthy page load time to worry about the whole CDN thing. It seems like I'm only shaving off a few milliseconds....not even 100s milliseconds, and my sales will be US only as of now. I was expecting to see half a second to 1 second benefit the way everyone raves about CDNs. It may be because the duplicate loading of the css and js files, so I'll see once I get that sorted and work out the kinks.

EDIT:
Just found this if anyone else will find it useful
https://www.clickittech.com/devops/clou ... 0the%20DNS.

v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by JNeuhoff » Sun Mar 17, 2024 3:23 am

paulfeakins wrote:
Thu Mar 14, 2024 11:09 pm
Joe1234 wrote:
Thu Mar 14, 2024 1:41 pm
How exactly do I point my images to a cdn?
Why not use Cloudflare?
Cloudflare can considerably slow down a website. forum.opencart.com is an example which barely works without constant challenges and slowdowns, especially when you access the site from a CGNAT line.

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 paulfeakins » Mon Mar 18, 2024 10:23 pm

JNeuhoff wrote:
Sun Mar 17, 2024 3:23 am
Cloudflare can considerably slow down a website. forum.opencart.com is an example which barely works without constant challenges and slowdowns, especially when you access the site from a CGNAT line.
That's only because it's in Attack Mode all the time. You don't have to use that functionality.

Our website uses CloudFlare and you tell me this isn't one of the fastest sites you've ever used: https://www.antropy.co.uk/

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


User avatar
Legendary Member
Online

Posts

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

Post by paulfeakins » Mon Mar 18, 2024 10:24 pm

Joe1234 wrote:
Sun Mar 17, 2024 1:13 am
@paul, why do you ask? If it's because you are going to point me to the cloudflare extension, I just don't pay for things that I think I can build myself that don't require excessive coding.
You're always so suspicious :laugh: I ask because Cloudflare has a free version and it's much easier to setup than whatever you're trying to do with config files etc. None of that is required with Cloudflare. Point your name servers at Cloudflare, add the site in Cloudflare to the free plan, and job done.

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


User avatar
Legendary Member
Online

Posts

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

Post by Joe1234 » Wed Mar 20, 2024 3:06 pm

paulfeakins wrote:
Mon Mar 18, 2024 10:23 pm
tell me this isn't one of the fastest sites you've ever used: https://www.antropy.co.uk/
Eh, I've seen faster, my site for example, image below lol...and I haven't even connected the CDN yet...AAAANND, it's the dreaded Journal with heavy images lol. Just fun, your site is pretty fast.
paulfeakins wrote:
Mon Mar 18, 2024 10:24 pm
You're always so suspicious
No suspicion, just wanted to make sure I answered whatever question you were getting at. But you are right, from your description cloudflare does seem way easier to setup. I may go the cloudflare route if the kinks I have are too bothersome to rectify and you are right about the aggressive setting.

Attachments

Screenshot (138).jpg

Screenshot (138).jpg (88.84 KiB) Viewed 801 times

Screenshot (137).jpg

Screenshot (137).jpg (111.46 KiB) Viewed 801 times


v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by paulfeakins » Wed Mar 20, 2024 8:35 pm

Joe1234 wrote:
Wed Mar 20, 2024 3:06 pm
paulfeakins wrote:
Mon Mar 18, 2024 10:23 pm
tell me this isn't one of the fastest sites you've ever used: https://www.antropy.co.uk/
Eh, I've seen faster, my site for example
No way is that accurate, our site loads as fast as static HTML so it must be the location you're running the test from.

What's your site URL?

Yes, give Cloudflare a go, it's very easy indeed.

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


User avatar
Legendary 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 18 guests