Post: How can load a image that is EITHER gif or jpg?
05-29-2011, 08:27 AM #1
anddrew
League Champion
(adsbygoogle = window.adsbygoogle || []).push({}); I have many images that are named 1.jpg, 2.jpg, 3.jpg and so on, occantianly there is a (lets say) 24.gif. How can that be loaded?
    
<?php
$i = $_GET['i'];
$directory = "images/";
if (glob("$directory*.*") != false)
{
$filecount = count(glob("$directory*.*"));
$realcount = $filecount - 1;
}
?>

</p>
<p> </p>
<p></p>
<p> </p>
<p><iframe src="images/<?php

if ($i <= 0 || $realcount < $i ){
echo "$realcount.jpg";}
else { echo "$i.jpg";} ?>" noframe seamless="seamless" width="100%" height="1949px"></iframe></p>

I know that isn't very pretty or anything. Is there a way (I tried using "*" to specify any filetype but no work.) would I have to make an exception?

ie.
     
if ($i <= 0 || $realcount < $i ){
echo "$realcount.jpg";}
else {
elseif ($i = 24){
echo"$i.gif"}else{
echo "$i.jpg";}


(might be wrong, I wrote this quickly)
help me please Smile
(adsbygoogle = window.adsbygoogle || []).push({});

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo