Peralelize image downloads across hostnames
-
Hi all,
I have a simple function (in function.php) that replaces the image hostname to speedup page loading:
function cdn_images() { $content = ob_get_contents(); $pattern = '/src=[\\"\']?([^\\"\']?.*(png))[\\"\']?/i'; preg_match_all( $pattern, $content, $matches ); foreach($matches[1] as $val) { $test = str_replace('www.domain.com', 'images.domain.com', $val); echo $test.'<br />'; } }
When placed on footer this obviously works well giving me new image paths. What I would like to do is to replace these images on the fly via WP hook.
Anyone knows how to do this?
Thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Peralelize image downloads across hostnames’ is closed to new replies.