Saving a HUGE bandwidth cost in WordPress by automatically serving media contents from copy.com

14 thoughts on “Saving a HUGE bandwidth cost in WordPress by automatically serving media contents from copy.com”

  1. have to try it out. Looks exciting😀
    একটা ছোট্টো টাইপো সম্ভবত ভাইয়া – in the last potion, shouldn’t it be “Now I owe you a surprise” instead of “Now you owe me a surprise” ?

  2. Boss, is it still working?? I’ve created a publicly shared folder in my copy.com account, uploaded some images in that public folder, but when I try to access any image via url, that url loads the copy.com file viewer page instead of serving the image over http. Or I’m missing any other configuration/setting in copy.com account to achieve this??

    1. I’ve verified that, static file serving only works with http protocol, accessing files via https protocol loads the file in a hosted viewer page in copy.com

      You may want to update the post to mention about this as well as changing the wordpress filter to something like below:

      function link_replacer($content){
      return preg_replace(“#http(s)?://” . preg_quote(‘your_wordpres_blog_url/wp-content/uploads/”,
      “http://copy.com/rNvQU2t2o4Z8/uploads/”, $content);
      }
      add_filter(“the_content”,link_replacer);

      Also it might be worth noting that, all text files are served with text/plain mime types, even though the file extension is css or html or js

    2. Correction in above code:

      function link_replacer($content){
      return preg_replace(‘#http(s)?://’ . preg_quote(‘your_wordpres_blog_url/wp-content/uploads/’,’#’) . ‘#m’,
      “http://copy.com/rNvQU2t2o4Z8/uploads/”, $content);
      }
      add_filter(“the_content”,link_replacer);

    3. Shihan bhai, for me it’s perfectly working via http and https. Please make sure that you had shared the folder publicly.

      Please see the following URL, it contains an https

      and displays directly in the browser.

    4. Interesting!! Now when I tried it again, it is working as expected. May be I was doing something wrong while building the url. Anyway, thanks for the great idea & sharing it.

      BTW, I would be more happy, if static text files could also be served from copy.com with appropriate mime type and I could move the css & js files along with the images there. If you can figure out an way for this, please share as well.

      Thanks again (Y)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s