WordPress.org

Ready to get started?Download WordPress

Forums

Help with Multisite Thumbnail URLs (4 posts)

  1. KGarrett
    Member
    Posted 2 years ago #

    Hello,

    I purchased a theme from themeforest.net that wasn't tested on multisite and it's having some trouble with thumbnail generation. I've narrowed it down to a problem with a script it's using called thumbnail.php. I'm not good with php and am really hoping someone will know a few lines of code to help me fix it.

    Here is the page that isn't generating thumbnails correctly: http://www.kellyagarrett.com/category/blog/ (scroll down a few posts...also note, one on that page DOES work, so I don't want to mess up that one!)

    Anyway, here is the thumbnail script:

    /*
     * Generate a thumbnail from an image url and return it's url
     *
     * @param string $img_url absolute url
     * @param int $width
     * @param int $height (optional)
     * @param boolean $cut (optional)
     */
    function generate_thumb($img_url, $width, $height, $cut = true){
    
        $default_upload_dir = "wp-content";
        $upload_dir = get_option("upload_path");
    
        // cut the url
        if (strpos($img_url, $default_upload_dir))
        {
            $img = substr($img_url, strpos($img_url, $default_upload_dir));
        }
        else
        {
            $img = substr($img_url, strpos($img_url, $upload_dir));
        }
        // resize the image
        $thumb = image_resize($img,$width,$height,$cut);
    
        if (is_string($thumb))
        {
            $thumb_ = site_url() . '/' .  $thumb;
        }
        else
        {
    
            $thumb_ = site_url() . '/' . $img;
        }
    
        return $thumb_;
    }
    
    ?>

    The thumbnails are being returned as: http://www.kellyagarrett.com/http://www.kellyagarrett.com/files/etc... so, basically, it's just duplicating the domain name and is finding the correct folder. The image that IS working currently, is located in a different uploads folder...I can't figure out how to change the uploads folder so it doesn't use a new folder every month.

    Is anyone able to help me? It would be greatly appreciated!

  2. I can't figure out how to change the uploads folder so it doesn't use a new folder every month.

    You don't on Multisite, that's how it works.

    And here's where I have to say annoying news :(

    The license here http://themeforest.net/wiki/support/legal-terms/licensing-terms/ for themeforest is ... well it's violating the GPL for WordPress by saying

    Unless you have our prior written consent, you must not directly or indirectly license, sub-license, sell or resell or provide for free the Work or offer to do any of these things unless the Work is incorporated into a work you have created. All of these things are referred to as Resale.

    Because of that, we cannot, in good faith, support a product that you purchased that isn't in full support of the licenses of WordPress.

    You'll need to seek support for the theme on themeforest's site.

  3. KGarrett
    Member
    Posted 2 years ago #

    Thanks, I will check with them. However, I'm not completely familiar with the GPL for WP, how is this in violation? Aren't they just saying I can't sell what I purchased from them without modifying it?

    Forgive me if I'm misunderstanding.

  4. Aren't they just saying I can't sell what I purchased from them without modifying it?

    No, they're saying you can't re-sell or giveaway the theme, and that's anti GPL.

    GPL freedoms include the freedom to do whatever you want with the code. That includes give it, sell it, edit it, etc etc.

Topic Closed

This topic has been closed to new replies.

About this Topic