Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Dec 2006
    Posts
    417
    Thanks
    168
    Thanked 1 Time in 1 Post

    how can you test if an image loads / file exists?

    I would like to write a php script that selects a large number of images paths/filenames on my server that I have stored in this mySQL table -- if the file doesn't exist on the server then I would like the id for that table item displayed

    Code:
    $sql="SELECT id,imageFilename FROM userTable LIMIT 1000"
    $result = mysql_query($sql);
    if($result){
      while($row=mysql_fetch_array($result)){
    
       if(what condition would I use in here to check to see if the file exists or loads?){
        echo '<p>this id '.$row[id].' needs to be fixed as it does not exist</p>';
      }
    }
    thanks

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,472
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    I don't think there's anything wrong with storing images in the MySQL database
    instead of in a sub-directory, but when it comes to manipulating them, it's so much
    easier when they reside on the website (not the MySQL database). Your problem is
    a case-in-point where storing in a directory would be so much easier.

    I'm still looking for the answer to your question.

  • Users who have thanked mlseim for this post:

    Bobafart (10-25-2009)

  • #4
    Regular Coder
    Join Date
    Dec 2006
    Posts
    417
    Thanks
    168
    Thanked 1 Time in 1 Post
    silly me

    thanks

    u rock


  •  

    Posting Permissions

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