• Resolved DoctorDR

    (@doctordr)


    I have an installation which uses wpmu sitewide tags plugin to gather all subsite blogs into the main tags blog and then display these on the home page (of the main tags blog).

    I also use the wootumblog plugin to distinguish each post custom taxonomy and then display either a default image (for audio, quote, link etc..) or grab the image from a post and then display – suitably scaled by timthumb to fit the display on my main tags blog homepage.

    You can see the home page on the following link – http://skiddnet.com

    I stumbled across the usual problems with such an approach, and have several functions constructed in functions.php;

    – catch_that_image() – which grabs the first image in a post
    – dyn_getimagepath($img_src) – which converts the relative path of images in a multisite installation to the absolute path needed by the timthumb script

    The problem with the ‘getimagepath’ function is that it returns a blog_id = 1 every time. This seems to be caused by the fact that since the script is running on the main tags blog (i.e. with a blog_id of 1), therefore the global $blog_id variable reflects the current blog.

    I came across the timthumb workaround by andrea_r – http://wpmututorials.com/hacks/timthumb-workaround/ – but could not make it work in my configuration.

    All I really need is a simple way of determining what the original blog_id is for a given url. So then I discovered the multisite function, get_blog_id_from_url, which andrea uses in her workaround, but I’m unclear how to use from studying the codex.

    What I believe I need to do is to break the URL into domain and path and then use get_blog_id_from_url, but I am still trying to figure out how to do so, or find any examples.

    Can anyone help?

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Using get_blog_id_from_url as a workaround for timthumb issue’ is closed to new replies.