Hi,
I have set both CDN settings, but only the normal img url seems to be replaced. Is there anything special I need to do to also replace the srcset url? or it this a bug maybe?
Hi,
I have set both CDN settings, but only the normal img url seems to be replaced. Is there anything special I need to do to also replace the srcset url? or it this a bug maybe?
You need to add to your code-base directly.
Hi Nicolai,
What is the purpose of the Host (GetImage.ashx) field if its not to point that function to the CDN, that is the behaviour I would expect?
If not can you point me in the direction to where we can edit that file
Thanks
It is the correct purpose - the feature does just not support srcset attribute as it right now...
So there is no way currently to point the srcset attribute to use the CDN rather than local file system?
Hi Joseph
Yes, currently that is correct.
I can see from the template code that this must be Swift. It is simple to modify the 2 templates that use srcset attribute to include the cdn prefix:
You can do something like this in the template:
You need to change these 2 templates
BR Nicolai
Thank you for your response and potential solution.
Unfortunately Pageview does'nt have CdnHostNameForGetImage as a memeber variable so it errors when trying to render it.
I also believe its the imagePathUrlEncoded that needs changing to point to the CDN rather than chainging the GetImage.ashx location
Hey Joe, Not sure if I'm talking BS here, but it could be a version thing. I see you are running 10.4.1, do you also have this issue when running 10.6.3?
My example was from DW9, you need to get the host like this on DW10:
Dynamicweb.Frontend.PageView.Current().Area.CdnImageHost
You cannot use the CDN host as a prepend of the imagePathUrlEncoded for GetImage like this:
GetImage.ashx?image=https://cdn.host...... as that would not work.
It has to be https://cdn.host.../admin/public/GetImage.ashx?image=somefolder/someimage.jpg - it requires a CDN that supports the proxying of the request like e.g. AWS does.
Otherwise you would have to totally remove the getimage.ashx part and go directly to the CDN - most CDNs these days also support image resizing.
What we had to use was Dynamicweb.Frontend.PageView.Current().CdnHostNameForImage
but that has now made the GetImage use the cdn for srcset
Thanks!
You must be logged in to post in the forum