Jump to content

Display more the just .jpg from thumbs with glob()?


joeysnacks

Recommended Posts

 

 

Hi

 

I am trying display thumbs from a directory, BUT , I cannot figure out how to show more then just .jpg.

 

For example, how could I make this code  show the following file extensions, .jpg  .png  .gif ?

 

Here is the code spinet and if you could advise that would be awesome :)

 

Thanks so much for your time in advance

 

<?php
$largeArray = glob("images/*.jpg");
$counter = 0; 
foreach (array_slice(glob("images/thumbs/*.jpg"),0,600) as $thumb) {
echo ("<div class='thumbgall'><a href='$largeArray[$counter]' rel='lightbox'><img src='$thumb'/></a></div>");
$counter++;
}
?>

Link to comment
Share on other sites

<?php
$images = glob("images/{*.jpg,*.gif,*.png}", GLOB_BRACE);
//print_r($images);
$counter = 0; 
foreach (array_slice($images,0,600) as $thumb) {
echo ("<div class='thumbgall'><a href='$images[$counter]' rel='lightbox'><img src='$thumb'/></a></div>");
$counter++;
}
?>

Link to comment
Share on other sites

<?php
$images = glob("images/{*.jpg,*.gif,*.png}", GLOB_BRACE);
//print_r($images);
$counter = 0; 
foreach (array_slice($images,0,600) as $thumb) {
echo ("<div class='thumbgall'><a href='$images[$counter]' rel='lightbox'><img src='$thumb'/></a></div>");
$counter++;
}
?>

 

Thank you sir ;)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.