I have a script that get images from a folder and then shows them on my site. But i have edited the script and now i have thumbnail-images in the same folder as the ordinary. Now i have a problem with the script, it shows all the images both ordinary and thumbnail-images on the site. All thumbnails have "thumb_" infront of the ordinary name, like thumb_hello.jpg, thumb_2.jpg, thumb_car.png etx etc.
How do i show only the ordinary images from the folder? Like hello.jpg, 2.jpg, car.png etc
The script im am using for the moment.
Is there anyone that has an idea? Maybe another preg_match or something? but i dont know how :/PHP Code:echo "<table class='reservdelar' style='width: 100%; padding: 4px;'>";
echo "<tr>";
echo "<td style='width: 70%;'>";
$kh = @opendir("bilder/trimdelar/$_GET[rID]");
while($bild = @readdir($kh)){
if(!($bild=="."||$bild=="..") && preg_match("#\.(gif|jpeg|jpg)$#i", $bild)){
$flerabilder[] = $bild;
}
}
@closedir($kh);
@$enbild = array_slice($flerabilder, 0, 1);
if (!empty($enbild)) {
echo "<img id='imgBig' src='bilder/trimdelar/$_GET[rID]/$enbild[0]' alt='' border='1' width='570px' height='445px'>";
}
echo "</td>";
echo "<td style='width: 30%; vertical-align: top;'>";
if (!empty($flerabilder)) {
foreach ($flerabilder as $bild) {
echo "<img src='bilder/trimdelar/$_GET[rID]/$bild' vspace='2' width='75' height='56' border='1' onclick=\"document.images['imgBig'].src='bilder/trimdelar/$_GET[rID]/$bild'\"><br />";
}
}
echo "</td>";
echo "</tr>";
echo "</table>";


Reply With Quote



Bookmarks