imagecreatefromjpeg() Error

Discussion in 'PHP' started by cb5sha, Oct 22, 2009.

  1. #1
    Hello everyone,

    I built a small website with photo uploading application. It was working fine on my localhost. But when i put it on a free webhost (000webhost.com), it occurs PHP error:
    imagecreatefromjpeg(folder/1/2009/10/19/1256219713.jpg):failed to open stream: No such file or directory.

    I dont know what the problem is.
    Does anybody have any ideas?
    I googled for imagecreatefromjpeg() errors, some of them mentioned about installing GD. I dont know what GD is and I didnt use it at all, does that matter?

    Thanks for any help.
     
    cb5sha, Oct 22, 2009 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Verify the path of the image. This error means that there is no image where the function is trying to find it. GD is installed otherwise you would get a Fatal undefined function error.
     
    jestep, Oct 22, 2009 IP
  3. cb5sha

    cb5sha Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for replying.
    You are right, I couldnt find the image in the folder where it is suppose to be.
    Ok, so the problem is the image wasnt uploaded to the correct place.

    I will be back again if i cant figure out why its not uploading to the correct place.

    Thank you.
     
    cb5sha, Oct 22, 2009 IP
  4. cb5sha

    cb5sha Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Please help!
    I'm getting this error now.

    Warning:move_uploaded_file(folder/1/2009/10/19/1256233660.jpg):failed to open stream:No such file or directory.

    Warning:move_uploaded_file():Unable to move'/tmp/phpfWMa32' to folder/1/2009/10/19/1256233660.jpg.
     
    cb5sha, Oct 22, 2009 IP
  5. ThomasTwen

    ThomasTwen Peon

    Messages:
    113
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It's the same error again, the image doesn't exist in the path you specified.
     
    ThomasTwen, Oct 22, 2009 IP
  6. orionoreo

    orionoreo Peon

    Messages:
    145
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    yup, you're opening from a non-existing image, then moving another non-existing one...


    verify your full path for the upload
     
    orionoreo, Oct 22, 2009 IP
  7. Gray Fox

    Gray Fox Well-Known Member

    Messages:
    196
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    130
    #7
    Use
    
    @mkdir(dirname($fullPathToFile),0777,true);
    
    PHP:
    when moving files and try using absolute file paths. Hint:
    
    define('ROOT',dirname(__FILE__));
    
    PHP:
     
    Gray Fox, Oct 22, 2009 IP