Accessing files from a local cdn I know that drupal comes along with 2 default stream-wrappers(public and private).
What I want to achieve is to have my images placed in an another server, where they can be accessed by a url similar to http://cdn.mysite.com/image/etc.png.

https://www.drupal.org/project/remote_stream_wrapper allows the use of http, and https as stream wrappers. How am I suppose to use this programmatically?

When a file is loaded "public://" is replaced by the actual public URL, how does this work with the above module? Could you provide any other info on how to tackle this issue?
I use Storage API for this sort of thing with S3 and cloudfront. I think it supports custom sub domains. It handles all the replication (copying,moving, deleting) itself. I have had a couple of minor compatibility issues with other contrib modules during upgrades. 

https://www.drupal.org/project/storage_api