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!