max22 Posted March 4, 2010 Share Posted March 4, 2010 Does anyone see anything wrong with this code? It's an image upload/thumbnail script. I get a Function name must be a string error on the last line of the code: Code snippet: $ou = imagecreatetruecolor($w, $h); imagealphablending($ou, false); $funcall = "imagecreatefrom$imtype"; imagecopyresampled($ou, $funcall($fromfile), 0, 0, 0, 0, $w, $h, $img[0], $img[1]); $funcall = "image$outype"; $funcall($ou, 'uploaded/cache/' . $_GET['w'] . '-' . md5($fromfile)); } $funcall($ou); <----------- This throws the error, can't figure out why. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted March 4, 2010 Share Posted March 4, 2010 Why don't you try doing a var_dump( $funcall ) right before the offending line and see what's in the variable. Quote Link to comment Share on other sites More sharing options...
max22 Posted March 4, 2010 Author Share Posted March 4, 2010 I should have mentioned, I tried that, and I tried: echo $ou . '|' . $funcall; but I get nothing at all from either one, like they're not even there. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted March 4, 2010 Share Posted March 4, 2010 Well I notice you have a closing bracket in the code you posted. So maybe they're null. Quote Link to comment Share on other sites More sharing options...
max22 Posted March 4, 2010 Author Share Posted March 4, 2010 I tried moving the last line above the } because what you said makes perfect sense. Sure enough, no error anymore. Thanks so much! I'm new here, but this place is great, talk about fast answers! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.