Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // transforms a relative image path into an absolute one for running timthumb on a parent WP multisite blog, which has been populated by the sitewide tags plugin
- function dyn_getimagepath($img_src) {
- if ($post_id == null) {
- global $post;
- $post_id = $post->ID;
- }
- global $post_blog_id;
- global $wpdb;
- $post_blog_id = get_post_meta($post->ID, 'blogid', true) ;
- if (isset($post_blog_id) && $post_blog_id > 0) {
- $imageParts = explode('/files/', $img_src);
- if (isset($imageParts[1])) {
- $img_src = '/wp-content/blogs.dir/' . $post_blog_id . '/files/' . $imageParts[1];
- }
- }
- return $img_src;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement