- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Interviewed on the Envato Notes blog
- Author was Featured
- Item was Featured
- Beta Tester
- Author had a File in an Envato Bundle
- Author had a Free File of the Month
In any case this is what you were asking if you really need it:
The network_site_url template tag retrieves the site url for the “main” site of the current network with the appropriate protocol, ‘https’ if is_ssl() and ‘http’ otherwise. If scheme is ‘http’ or ‘https’, is_ssl() is overridden.
http://codex.wordpress.org/Function_Reference/network_site_urlCheers,
Parker
- Sold between 100 000 and 250 000 dollars
- Won a Competition
- Author was Featured
- Item was Featured
- Referred between 500 and 999 users
- Author had a Free File of the Month
- Author had a File in an Envato Bundle
- Bought between 10 and 49 items
not sure if i got the problem but wouldn’t be simpler to just strip upload url from image and prepend upload dir to obtain file path ?
BF
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Interviewed on the Envato Notes blog
- Author was Featured
- Item was Featured
- Beta Tester
- Author had a File in an Envato Bundle
- Author had a Free File of the Month
pixelentity said
not sure if i got the problem but wouldn’t be simpler to just strip upload url from image and prepend upload dir to obtain file path ? BF
Yes, is what I do in my function I guess… because when you get the image url in a sub blog, the url returned is passed through rewrite rules, so it needs to be modified to point to the real sub blog uploads folder on server, otherwise scripts like timthumb fail.
- Sold between 100 000 and 250 000 dollars
- Won a Competition
- Author was Featured
- Item was Featured
- Referred between 500 and 999 users
- Author had a Free File of the Month
- Author had a File in an Envato Bundle
- Bought between 10 and 49 items
ParkerAndKent saidI was suggesting to use something like
Yes, is what I do in my function I guess… because when you get the image url in a sub blog, the url returned is passed through rewrite rules, so it needs to be modified to point to the real sub blog uploads folder on server, otherwise scripts like timthumb fail.
$ud = wp_upload_dir(); $file = str_replace($ud["baseurl"],$ud["basedir"],$url);didn’t test at all but wp_upload_dir() would always provide right values whether multisite is enabled or not.
BF
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Interviewed on the Envato Notes blog
- Author was Featured
- Item was Featured
- Beta Tester
- Author had a File in an Envato Bundle
- Author had a Free File of the Month
pixelentity said
ParkerAndKent saidI was suggesting to use something like
Yes, is what I do in my function I guess… because when you get the image url in a sub blog, the url returned is passed through rewrite rules, so it needs to be modified to point to the real sub blog uploads folder on server, otherwise scripts like timthumb fail.$ud = wp_upload_dir(); $file = str_replace($ud["baseurl"],$ud["basedir"],$url);didn’t test at all but wp_upload_dir() would always provide right values whether multisite is enabled or not. BF
Mmm, could work, but I never tested that… so not sure if it would work correctly… In any case I do something very similar:
$url = explode('/files/', $url);
if (isset($url[1])) {
$url = '/blogs.dir/' . $blog_id . '/files/' . $url[1];
}
Should be tested to see what wp_upload_dir() exactly returns on a sub blog.
- Sold between 100 000 and 250 000 dollars
- Won a Competition
- Author was Featured
- Item was Featured
- Referred between 500 and 999 users
- Author had a Free File of the Month
- Author had a File in an Envato Bundle
- Bought between 10 and 49 items
ParkerAndKent saidit returns sub blog correct values (blogs.dir), that i can assure.
Should be tested to see what wp_upload_dir() exactly returns on a sub blog.
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Interviewed on the Envato Notes blog
- Author was Featured
- Item was Featured
- Beta Tester
- Author had a File in an Envato Bundle
- Author had a Free File of the Month
pixelentity said
ParkerAndKent saidit returns sub blog correct values (blogs.dir), that i can assure.
Should be tested to see what wp_upload_dir() exactly returns on a sub blog.
Well, in that case, that’s a perfect solution 
- Author was Featured
- Bought between 50 and 99 items
- Exclusive Author
- Has been a member for 3-4 years
- Item was Featured
- Referred between 50 and 99 users
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Sold between 250 000 and 1 000 000 dollars
The thing is that I dont want to use relative url as a ”/images/img1.jpg”, but I want to use “http://yourserver.com/wordpress/MU-blog1/img.jpg” and that’s the reason why I need to know the base url of wordpress instalation. Anyway thank you guys, I will test this solution and push it to the branch 
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Interviewed on the Envato Notes blog
- Author was Featured
- Item was Featured
- Beta Tester
- Author had a File in an Envato Bundle
- Author had a Free File of the Month
freshface said
The thing is that I dont want to use relative url as a ”/images/img1.jpg”, but I want to use “http://yourserver.com/wordpress/MU-blog1/img.jpg” and that’s the reason why I need to know the base url of wordpress instalation. Anyway thank you guys, I will test this solution and push it to the branch![]()
I guess it’s enough to add $url0 before:
$url = explode('/files/', $url);
if (isset($url[1])) {
$url = $url[0] . '/blogs.dir/' . $blog_id . '/files/' . $url[1];
}
The whole $url is an absolute link to image 
Parker
- Author was Featured
- Bought between 50 and 99 items
- Exclusive Author
- Has been a member for 3-4 years
- Item was Featured
- Referred between 50 and 99 users
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Sold between 250 000 and 1 000 000 dollars
I just remembered why I was doing this. It’s because when you want to resize some theme images, located directly in theme folder ( shadows and other things ), it won’t work at multisite. So I have to do this small fix:
If there is a "/theme/" word in the URL, redirect to the original url![]()
uploaded the 1.21 fixed version 
