storeLocation = ?

Posted: April 15, 2019 at 8:44 AM Quote #227521
I'm trying to insert the CDN link for images (of products and categories).

I tried editing in the page: "Librarias / Nop.Services / Media / PictureService.cs":



//protected virtual string GetThumbUrl(string thumbFileName, string storeLocation = null)
      protected virtual string GetThumbUrl(string thumbFileName, string storeLocation = "cdn-img.r.worldssl.net")
    {
            storeLocation = !string.IsNullOrEmpty(storeLocation)
                                    ? storeLocation
                                    : _webHelper.GetStoreLocation();
            var url = storeLocation + "images/thumbs/";



After these changes I recompiled in Release and then posted on the server.

I deleted the cache, restarted the application and the Application pools on the server.

The result is that nothing has changed. All images always point, as before, to the URL of the site.

Where am I wrong?

Thanks
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: April 15, 2019 at 4:56 PM Quote #227540
I dont know anything about CDN but I assume you are storing images in file system rather than database ?

    protected virtual string GetThumbUrl(string thumbFileName, string storeLocation = "cdn-img.r.worldssl.net")
    {

The command string storeLocation = "cdn-img.r.worldssl.net" will only be invoked if no parameter is passed in
If null is passed in as a parameter that is what is used and hence it goes to the store location

If you always want to force it to use your location you need to set the parameter you pass in somewhere before the call to this routine

           storeLocation = "http://cdn-img.r.worldssl.net";
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
www.SelectSystems.com.au
Select Systems International is a computer systems technology solution developer and integration service provider.
Posted: April 16, 2019 at 10:27 AM Quote #227566
Hi Ydna and thanks for your reply.

"I assume you are storing images in file system rather than database?"

Yes, I store the images directly in the server (in wwwroot / images /), not in the database.

"We need to set up a routine"

And how should I do it?
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: April 16, 2019 at 3:48 PM Quote #227580
You switched on Pictures are stored into...file system ?
And you are using a CDN to replicate the files from nopCommerce41\wwwroot\images\thumbs to your CDN Directory ?

I do not know what is involved without doing it but I assume everywhere you are loading files you need to force it to use your CDN directory

Maybe there is more to it ? There are plugins in the marketplace - dont know what else they do

https://www.nopcommerce.com/marketplace.aspx?searchterm=cdn

This one is free maybe have a look what it does

https://www.nopcommerce.com/p/947/nopaccelerate-cdn-free-cdn-plugin-for-nopcommerce.aspx
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
www.SelectSystems.com.au
Select Systems International is a computer systems technology solution developer and integration service provider.
Premium support services
  • Dedicated premium support services provided by core developers are intended for persons who run mission critical websites, work on projects with tight deadlines, or want to get dedicated support.
Professional services
  • Want to open a new store? Want to take your store to the next level? Need a custom extension? We can customize nopCommerce to fit your store perfectly. Request a quote to get started.