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. Link to comment https://forums.phpfreaks.com/topic/194171-function-name-must-be-a-string-issue/ 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. Link to comment https://forums.phpfreaks.com/topic/194171-function-name-must-be-a-string-issue/#findComment-1021619 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. Link to comment https://forums.phpfreaks.com/topic/194171-function-name-must-be-a-string-issue/#findComment-1021626 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. Link to comment https://forums.phpfreaks.com/topic/194171-function-name-must-be-a-string-issue/#findComment-1021628 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! Link to comment https://forums.phpfreaks.com/topic/194171-function-name-must-be-a-string-issue/#findComment-1021633 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.