[PHP] imagecreatefromjpeg problem

Discussion in 'Web Design & Coding' started by Khayman, Apr 12, 2005.

  1. Khayman

    Khayman I'm sorry Hal... Political User Folding Team

    Messages:
    5,518
    Location:
    England
    I've been playing with imagecreatefromjpeg and for the most part it works, but i moved the code to a new director and it doesn't

    this directory stucure works with the code in photos and the pics in "me"
    photos
    +pics
    ++me
    +++thumbs

    but if I move the code to another directory, such as admin, then i get the error that the file does no exist.
    photos
    +pics
    +-me
    +--thumbs
    +admin

    it seems I cannot pass it a filepath which goes back up the tree and then down again such as "/pics/me/test.jpg"


    That probably makes no sense to anyone. Its hard to explain, but its a simple problem. i hope someone knows a way around it
     
  2. j79zlr

    j79zlr Glaanies script monkey Political User

    Messages:
    2,725
    Location:
    Chicago
    You can't use / to begin the file path, using:

    +pics
    +-me
    +--thumbs
    +admin

    The file path from the admin directory would have to be

    "../pics/me/test.jpg"
     
  3. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    / means the root of the filesystem.

    You are trying to access /pics/me which would be in /, what you want is the location, down below from the current location, so ../ or ./../ would do the trick.

    If Apache is not chrooted, / is where the Linux/unix file system begins. If this is on Windows, disregard my comments about what / is.
     
  4. Khayman

    Khayman I'm sorry Hal... Political User Folding Team

    Messages:
    5,518
    Location:
    England
    Its on Apache, but running on Windows (although it will finaly be running in Linux)

    i have tried ../path and that works for most other functions but not for "imagecreatefromjpeg " function. Or I assume so as it actualy fails on "imageSX" which takes the result from "imagecreatefromjpeg" and then fails saying invalid resource
     
  5. Khayman

    Khayman I'm sorry Hal... Political User Folding Team

    Messages:
    5,518
    Location:
    England
    never mind, fixed it now it was somthing else kind of. i'm dumb :)