Using a CDN for user Image and Video uploads
I am planning on using a CDN for user image and video uploads for my site. The only problem is I cannot upload direct to a CDN as I need to process and manipulate the image and videos before they get stored on my server using GD Image Library and FFMPEG.
What is the best way for me to get the capacity and delivery benefit of a CDN 开发者_如何转开发but still be able to process the files that get uploaded there?
I want the videos and images to be available for review after upload almost instantly. I don't want the user to have to experience a double upload time (sent to my server, then sent to CDN).
The only solution I can think of is storing a temporary version of the files on my server and then behind the scenes sending a copy to the CDN. Once the upload to the CDN is complete all paths to the file would be switch to the CDN instead of my server. Does this make sense?
Use a CDN that provides an API.
A great CDN service in the UK and USA is Rackspace. They provide an API for a lot of programming languages such as PHP.
You may have to spend processing power but from then on bandwidth can be on the CDNs back. You can also outsource video encoding with a service like panda stream
精彩评论