Title: [Plugin: Shortcodes Ultimate] Multisite patch to use TimThumb
Last modified: August 20, 2016

---

# [Plugin: Shortcodes Ultimate] Multisite patch to use TimThumb

 *  Resolved [rmose](https://wordpress.org/support/users/rmose/)
 * (@rmose)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-multisite-patch-to-use-timthumb/)
 * As discussed in
 * [http://wordpress.org/support/topic/plugin-shortcodes-ultimate-carousel-gallery-and-nivo-dont-work-on-multisite-installations?replies=16](http://wordpress.org/support/topic/plugin-shortcodes-ultimate-carousel-gallery-and-nivo-dont-work-on-multisite-installations?replies=16)
 * there is a problem with multisite installations. The issue is that TimThumb is
   being called with the pretty URL of the image. TimThumb is a general tool and
   has no understanding of the mapped directory structure in a WordPress multisite
   installation. As a result, it makes some assumptions that are not valid in this
   situation.
 * Either a WordPress-aware alternative should be used, or more details have to 
   be provided to TimThumb. The second option is not desirable, because it exposes
   the internal directory structure to the Internet and unmaps pretty URLs. TimThumb
   isn’t really the right tool to use here, but given that it is being used, the
   plugin or theme writer has to generate the proper information for TimThumb.
 * The solution below is based on the fix I developed for vSlider and discussed 
   here.
 * wordpress.org/support/topic/plugin-vslider-multi-image-slider-for-wordpress-multisite-
   patch-for-vslider-to-use-timthumb
 * Modify shortcodes-ultimate.php by inserting the code for the following function
   anywhere in the file along with the other functions.
 *     ```
       /**
                * If the blog_id is defined (i.e., multisite) and the
                * given URL references a files directory, return
                * the URL with the initial part replaced with the
                * specific path to the current blog's files.
                */
               function su_replace_blogpath($url) {
                       global $blog_id;
                       if (isset($blog_id) && $blog_id > 0) {
                               $blogs_dir = '/blogs.dir/' . $blog_id;
                               $image_parts = explode('/files/', $url);
                               if (isset($image_parts[1])) {
                                       $url = $blogs_dir . '/files/' . $image_parts[1];
                               }
                       }
                       return $url;
               }
       ```
   
 * Then, enter the lib directory and update images.php, media.php and shortcodes.
   php. Search for the lines with timthumb that look like
 * `'/lib/timthumb.php?src=' . $something . $something_else`
 * and change them to
 * `'/lib/timthumb.php?src=' . su_replace_blogpath($something) . $something_else`
 * For example, line 55 of images.php looks like
 *     ```
       'thumbnail' => su_plugin_url() . '/lib/timthumb.php?src=' . $attachment->guid . '&w=' . $width . '&h=' . $height . '&zc=1&q=100',
       ```
   
 * Add the call to su_replace_blogpath() around $attachment->guid so that the specific
   blog path will be used rather than the pretty URL.
 *     ```
       'thumbnail' => su_plugin_url() . '/lib/timthumb.php?src=' . su_replace_blogpath($attachment->guid) . '&w=' . $width . '&h=' . $height . '&zc=1&q=100',
       ```
   
 * The tests here have been successful on a multisite, but it should be tested further
   to be sure that it works as expected for everyone.
 * [http://wordpress.org/extend/plugins/shortcodes-ultimate/](http://wordpress.org/extend/plugins/shortcodes-ultimate/)

Viewing 1 replies (of 1 total)

 *  [AsmaYasrib | GraphicWeave](https://wordpress.org/support/users/asmaysrib/)
 * (@asmaysrib)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-multisite-patch-to-use-timthumb/#post-2566906)
 * since this post was like 11 months back, i guess the current version is updated?
   and supports multisite?
    thanks 🙂

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Shortcodes Ultimate] Multisite patch to use TimThumb’ is closed
to new replies.

 * ![](https://ps.w.org/shortcodes-ultimate/assets/icon-256x256.gif?rev=2547563)
 * [Shortcodes Ultimate - Content Elements](https://wordpress.org/plugins/shortcodes-ultimate/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcodes-ultimate/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcodes-ultimate/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcodes-ultimate/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcodes-ultimate/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcodes-ultimate/reviews/)

## Tags

 * [multisite](https://wordpress.org/support/topic-tag/multisite/)

 * 1 reply
 * 2 participants
 * Last reply from: [AsmaYasrib | GraphicWeave](https://wordpress.org/support/users/asmaysrib/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-multisite-patch-to-use-timthumb/#post-2566906)
 * Status: resolved