or, try this:

<?
$c = "143";
if(file_exists('{$c}.gif'))
    {
    echo '<img src="{$c}.gif">';
    }
elseif(file_exists('{$c}.jpg'))
    {
    echo '<img src="{$c}.jpg">';
    }
else
    {
    echo '<img src="oooops.gif">';
    }
?>

Justin French
--------------------
Creative Director
http://Indent.com.au
--------------------



on 29/05/02 7:56 PM, r ([EMAIL PROTECTED]) wrote:

> Hi PHP ppl,
> 
> I have a directory named cartoons,
> it has around 180 files in them ONLY images,
> the filenames are 1.jpg, 2.jpg......5.gif, 6.gif etc etc
> if you got confused with the above line its basically all the files are
> numbered from 1-180 and the file types are mixed JPG and
> GIF.
> 
> I have a program that displays each of the cartoons displays a  <-- Prev  *
> * *  Next--> link, basicaly theres a hidden field that specifies the current
> number and if you click prev its c=c-1 and if your press next its c=c+1, but
> I have no idea if the next cartoon is either JPG or GIF and so am displaying
> both like so in my code:
> 
> <img src=$c.gif>
> <img src=$c.jpg>
> since only one is valid the other shows an ugly blank image placeholder
> graphic.
> 
> Any idea on how i can read the last three letters of the file to determine
> if its gif/jpg?
> 
> Kindly reply,
> -Ryan.
> 


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

Reply via email to