...

View Full Version : how can you test if an image loads / file exists?



Bobafart
10-19-2009, 02:10 PM
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



$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

abduraooft
10-19-2009, 02:15 PM
file_exists() (http://php.net/file_exists) ?

mlseim
10-19-2009, 09:18 PM
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.

Bobafart
10-25-2009, 07:16 PM
silly me

thanks

u rock



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum