Design and CSS styles
Version 5.x > Design and CSS styles > CDN - how to switch images to New Domain in bulk View modes: 
User avatar
Member
Member
dbaird-myus - 9/8/2011 1:48:21 PM
   
CDN - how to switch images to New Domain in bulk
We'd like to use a CDN for serving our images.

We plan to create a new domain (say XYZ.com) specifically for the images and per the instructions of the CDN we'd CNAME this to the CDN so all image requests are actually routed through them. They'd then hit our server from time to time to get fresh images.

Unfortunately, the entire site has been setup under 1 domain. 99.9% of the images are accessed via the Media Gallery (yes to store in file and yes to store in database and yes to redirect to file server).

Note, we'd still store the images on our side but the CDN would cache them and serve to the user -- only hitting our server when expire headers indicate need or we say to refresh.

The question is how do quickly and effectively have all the img tags point to the new domain ?



User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 9/11/2011 5:35:11 AM
   
RE:CDN - how to switch images to New Domain in bulk
Hello,

The way of changing the image URLs depends on the approach you are using to display such images.

If you display them via some listing web part then it will be just about the transformation change.

On the other hand, having them in the WYSIWYG Editor means you need to go through each editable region in particular document and change them manually. Of course, you could create an SQL script which will select all the DocumentContent columns, parse out images, change their URLs and update the record for all available documents.
Moreover, I can think of the API script, which would do the same, but in C# code.

Hope this helps you.

Best regards
Ondrej Vasil