helloise Posted April 1, 2011 Share Posted April 1, 2011 i hasve the following code: $filename = "Rainbow-code-1_blck.jpg"; if (file_exists(sfConfig::get('sf_upload_dir') . '/rainbowcode/images/profilepics/'.$filename)) { echo "file found"; $source = imagecreatefromjpeg($filename); } but i get the following warning: Warning: imagecreatefromjpeg(Rainbow-code-1_blck.jpg): failed to open stream: No such file or directory in /home/helloises/traffic_2/phoenix/plugins/rainbowCodePlugin/lib/model/RcProfileTable.php on line 168 i dont understand my file does exist...it goes in to the if cos the echo executes please help i am new to this and have no idea how to fix this thank you Quote Link to comment https://forums.phpfreaks.com/topic/232377-problem-with-imagecreatefromjpeg/ Share on other sites More sharing options...
dcro2 Posted April 1, 2011 Share Posted April 1, 2011 imagecreatefromjpeg() is looking for Rainbow-code-1_blck.jpg in the directory your php script is in. Include the whole path like you did with file_exists(): $filename = "Rainbow-code-1_blck.jpg"; if (file_exists(sfConfig::get('sf_upload_dir') . '/rainbowcode/images/profilepics/'.$filename)) { echo "file found"; $source = imagecreatefromjpeg(sfConfig::get('sf_upload_dir') . '/rainbowcode/images/profilepics/'.$filename); } Quote Link to comment https://forums.phpfreaks.com/topic/232377-problem-with-imagecreatefromjpeg/#findComment-1195708 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.