SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2002
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    file_exists() error...

    Hi,

    I'm trying to use the file_exists() function to load an image but get repeated errors. Code is as follows:

    // Foto //
    if (file_exists("/production/img/retratos/".$row['ID'].".jpg")) { ?>
    <img src='/production/img/retratos/<?PHP echo $row['ID'] ?>.jpg"' width='80' height='80' border='0'>
    <? } else { ?>
    <img src='/production/img/retratos/nophoto.jpg' width='80' height='80' border='0'>
    <? }

    The result of the above code is to set ALL images as non-existent and to load the no photo image (even though the photos do exist). It's not Db related as the standard images call here:

    echo ("<img src='/production/img/retratos/".$row['ID'].".jpg' width='80' height='80' border='0'>\n");

    ... works just fine.

    What am I missing? Surely the file does not have to be in the same dir?

    Thanks for any advice / comments.

    Gary

  2. #2
    Custom User Title v1.0 FireFly's Avatar
    Join Date
    Aug 2001
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Remove the first / before production in the file_exists() call (I think, unless production is really in the root).


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •