CDN works like most do (I have used cloudflare in the past and can see some flaws with their product)
Simply works via subdomain. ie if your domain name is image.com
Image is located at image.com/image.jpg
with cdn you use cdn.image.com/image.jpg
cdn.image.com is CNAME to your CDN url which distributes the content .. so all we need to do is force all image links to cdn.image.com instead of image.com
Hope this makes sense 🙂