> i have this snippet of code, from what i can tell it works .. just
> wondering
> if i am doing it in a correct way, or if there is a better, or faster
way.
> thanks for any input.
> 
> $fp = @fopen("$_SERVER[DOCUMENT_ROOT]/images/$mapname.jpg","r");
> 
> if ( $fp )
>  {
>  $mappic = "<img border=\"0\" src='/images/mappics/$mapname.jpg'></a";
> }
> else
>  {
>  $mappic = "<img border=\"0\" src='/images/noimage.gif'>";
> 
>  }
> @fclose ( $fp );
> 
> echo $mappic;

How about using file_exists() to check, rather than trying to open it?

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to