1
vote
Add option to rewrite URLs of images for gallery to serve them from CDN.
Right now this could be done with the following hook:
// ********************
// Iconic Woothumbs: serve swiper images from CDN
add_action( ‘iconic_woothumbs_all_images_data’, ‘add_cdn_to_single_image_data’, 10, 2);
function add_cdn_to_single_image_data( $images, $product_id ){
if (is_array( $images )) {
for ($i = 0; $i $value) {
if (mb_strpos($key, ‘url’) !== false || mb_strpos($key, ‘src’) !== false) {
$images[$i][$key] = str_replace(‘your-site.com’, ‘cdn.your-site.com’,$images[$i][$key]);
}
}
}
}
return $images;
}