Re: [PHP3] testing for image file

From: Date: Wed, 14 Jun 2000 22:08:45 +0000
Subject: Re: [PHP3] testing for image file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-1883@lists.php.net to get a copy of this message
Here is my input.. Taken from the PHP Manual... file_exists file_exists -- Check whether a file exists Description int file_exists(string filename); Returns true if the file specified by filename exists; false otherwise. file_exists() will not work on remote files; the file to be examined must be accessible via the server's filesystem. Jordan "Patrick Larkin" <plarkin@beth.k12.pa.us> wrote in message news:B56D707D.7AE2%plarkin@beth.k12.pa.us... > > Hello: > > I'm using Apache, php3 and MySQL on LinuxPPC. > > I have the following code: > > if ($schoolnumber == 50) { > PRINT "<img src=\"$picture\" width=\"128\" > height=\"160\">"; > } elseif ($schoolnumber == 53) { > PRINT "<img src=\"$picture\" width=\"128\" > height=\"160\">"; > } else { > PRINT "<img src=\"$nopicture\" width=\"128\" > height=\"160\">"; > } > > Basically, it tests does this: > > If the school is 50, show a picture. > If the school is 53, show a picture. > If its any other school, show a blank placeholder. > > I do this because we only have pictures for people in Schools 50 and 53. > > My issue is now that not all people have pictures, even in schools 50 or 53. > I need to test whether the picture exists and if not, display the > placeholder. > > Each person has an ID (xxxxxx) and their picture is xxxxxx.jpg. How can I > test to see if http://webserver/xxxxxx.jpg exists? Like this: > > $id = 123456 > > if http://webserver/123456.jpg exists > display http://webserver/123456.jpg > else > display placeholder > > > > Can php do this? Thanks > > > > > -- > Patrick Larkin > Network Automation > BASD > > > -- > PHP 3 Mailing List <http://www.php.net/> > To unsubscribe, send an empty message to php3-unsubscribe@lists.php.net > To subscribe to the digest, e-mail: php3-digest-subscribe@lists.php.net > To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#1883) next »