Skip to content

Instantly share code, notes, and snippets.

@joshellington
Created March 27, 2012 20:18
Show Gist options
  • Save joshellington/2219927 to your computer and use it in GitHub Desktop.
Save joshellington/2219927 to your computer and use it in GitHub Desktop.
wordpress image path
function get_image_path($img_src) {
global $blog_id;
if (isset($blog_id) && $blog_id > 0) {
$imageParts = explode('/files/', $img_src);
if (isset($imageParts[1])) {
$img_src = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
}else {return $imageParts ;}
}
return $img_src;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment