Jump to content

Archived

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

GremlinP1R

Display all...

Recommended Posts

Hi there...

How would I be able to display all pic in on dir on a page??
Can some one please help...

Share this post


Link to post
Share on other sites
you could store all pic names in db and then loop the result.

Regards,
George

Share this post


Link to post
Share on other sites
[code]
<?php
    if ( $img_dir = @opendir('../images/') ) {
        while ( false !== ($img_file = readdir($img_dir)) ) {
            // add checks for other image file types here, if you like
if ( preg_match("/(\.jpg)$/", $img_file) ) {
              echo "<img src = '$img_file'>";
            }
        }
        closedir($img_dir);
    } else {
        echo "wrong path";
    }
?>
[/code]

Share this post


Link to post
Share on other sites
Thanx that code works, sort of...

it makes places for all inmages, counts them and create a blok but its not displaying...
Any reason why it would not display??

Thanx..

Share this post


Link to post
Share on other sites
This isn't a place for handouts.... have you attempted anything yourself? can we see YOUR code and let us know any errors YOu might be having.

Share this post


Link to post
Share on other sites

×

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.