69 posts Siiimple
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has referred 100+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+4 more
Siiimple says

Hey everyone,

I’m having an issue with a script that I use rather frequently as a TimThumb alternative. It works great for 99% of the themes, but I’ve received in one case an error that I don’t know quite how to solve.

“Catchable fatal error: Object of class WP_Error could not be converted to string”

Referring to line:

$new_img_size = getimagesize( $new_img_path );

I seem to recall another discussion (can’t find it) on the boards about this particular script, and several mentioned they use it frequently. Here’s the script link:

http://core.trac.wordpress.org/ticket/15311

Any advice what the error is referring to or how to go about solving it would be great!

Thanks!

1950 posts Do the Needful
  • Has sold $125,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
+10 more
JamiGibbs says

I seem to recall having an issue with this in the (far) past once and if I recall, the problem was because the user had set a different image upload folder path than the WP default:

http://cl.ly/390p1s2V2d2L1q1j3U3X
69 posts Siiimple
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has referred 100+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+4 more
Siiimple says

Looks like they have the default settings in place. It’s a strange problem, I guess. Thanks for your help, Jami.

147 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+2 more
FlexiPress says

“Catchable fatal error: Object of class WP_Error could not be converted to string”

Referring to line:

$new_img_size = getimagesize( $new_img_path );

the problem comes from previous line:

        $new_img_path = image_resize( $file_path, $width, $height, $crop );
        $new_img_size = getimagesize( $new_img_path );

the image_resize function requires GD Library to be installed in your server.

ask your buyer to contact his hosting support to activate GD Library on his server.

69 posts Siiimple
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has referred 100+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+4 more
Siiimple says

Thanks, I’ll see if that’s the issue.

Appreciate your help!

115 posts Too Much is Never Enough
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has referred 200+ members
+4 more
premitheme says

I used this script too, but had some issues regarding $_SERVER['DOCUMENT_ROOT'] variable. Lately I figured out that there is two lines commented out (the last two lines) ...

            $file_path = parse_url( $img_url );
            $file_path = $_SERVER['DOCUMENT_ROOT'] . $file_path['path'];

            // Look for Multisite Path
            if(file_exists($file_path) === false){
                global $blog_id;
                $file_path = parse_url( $img_url );
                if (preg_match("/files/", $file_path['path'])) {
                    $path = explode('/',$file_path['path']);
                    foreach($path as $k=>$v){
                        if($v == 'files'){
                            $path[$k-1] = 'wp-content/blogs.dir/'.$blog_id;
                        }
                    }
                    $path = implode('/',$path);
                }
                $file_path = $_SERVER['DOCUMENT_ROOT'].$path;
            }
            //$file_path = ltrim( $file_path['path'], '/' );
            //$file_path = rtrim( ABSPATH, '/' ).$file_path['path'];

I see that these two lines are not grayed out in the latest version of the script, I’m not sure if they should solve $_SERVER['DOCUMENT_ROOT'] issue. Do you have any idea?

Sorry, not very experienced in PHP !

69 posts Siiimple
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has referred 100+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+4 more
Siiimple says

Well, the journey continues on.

The client said they double check that GD Library was installed, so I guess that’s not the issue.

Not sure about the two grayed out lines. I tried to activate them, but that didn’t seem to do anything.

115 posts Too Much is Never Enough
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has referred 200+ members
+4 more
premitheme says

Do you use the latest version of the script? I it’s this … https://gist.github.com/930234/5d5ba6a426c4981c6648098d68554ca0f93127c4

I’m also not sure what to use, TimThumb or this script ( vt_resize ), the only downside is the DOCUMENT _ROOT variable issue! but I think it’s resolved.

1950 posts Do the Needful
  • Has sold $125,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
+10 more
JamiGibbs says

Just out curiosity, do they have WordPress installed on a subdomain or something other than a top level folder? Also, are they using a WordPress MU installation?

69 posts Siiimple
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has referred 100+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+4 more
Siiimple says

I checked, and it’s installed in the root domain. No, they’re not MU. The script was working fine for several months, but then just donked out. The error keeps pointing to:

 $new_img_path = image_resize( $actual_file_path, $width, $height, $crop );
$new_img_size = getimagesize( $new_img_path );
 $new_img = str_replace( basename( $image_src[0] ), basename( $new_img_path ), $image_src[0] );

Catchable fatal error: Object of class WP_Error could not be converted to string line 209

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by