The reason is to change image urls from site.com/wp-content/uploads to static.site.com. Cdn plugins change to static.site.com/wp-content/uploads so i can not use them.
I think it’s better to update the database content instead of replacing strings in each page-load.
Check this easy DB replacement tool: https://github.com/interconnectit/Search-Replace-DB
Keep in mind to remove it after you’ve done your changes!