Using a Content Delivery Network

2 posts by 2 authors in: Forums > CMS Builder
Last Post: September 28, 2009   (RSS)

Re: [jonoc73] Using a Content Delivery Network

By Dave - September 28, 2009

Hi jonoc73,

I'm not familiar with Amazon S3 but if it works like other content delivery networks you should be fine.

CMS Builder displays an image like this:
<img src="<?php echo $upload['urlPath'] ?>" ... />

Which might display like this:
<img src="/uploads/yourImage.jpg" ... />

So you can hardcode a different domain like this:
<img src="http://E123456.cloudfront.net/<?php echo $upload['urlPath'] ?>" ... />

Which would display to the browser as:
<img src="http://E123456.cloudfront.net/uploads/yourImage.jpg" ... />

Then all you'd need to do is ensure CloudFront loads a copy of the original image off your server if it doesn't already have it cached or upload the images yourself. (We could also build you a plugin that did it automatically if needed).

Hope that helps! Let me know if you have any other questions about that.
Dave Edis - Senior Developer
interactivetools.com