Jump to content

problem with imagecreatefromjpeg


helloise

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/232377-problem-with-imagecreatefromjpeg/
Share on other sites

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);
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.