Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About et4891

  • Rank
    Regular Member

Recent Profile Visitors

2,552 profile views
  1. not a specific sub directory...I want to find all images in all sub directory and then make it thumbnail.
  2. I found a way to do what I want but still missing something here I couldn't figure out... this is what I have at the moment... <?php function dirToArray($dir) { $contents = array(); foreach (scandir($dir) as $node) { if ($node == '.' || $node == '..') continue; if (is_dir($dir . '/' . $node)) { $contents[$node] = dirToArray($dir . '/' . $node); } else { $contents[] = $node; } } return $contents; } $c=(""); $r = dirToArray('./images'); foreach($r as $a) { foreach($a as $b) { if(substr($b, -3) == "png") { $c.="<img src='/images/" . $b . ".png'>"; } } } echo $c; ?> but when I look at the source code....I see... <img src='/images/Screenshot_2013-06-02-19-41-36.png'> but I need it to be <img src='/images/(directory)/Screenshot_2013-06-02-19-41-36.png'> somehow I can't think how to implement the (directory) in...
  3. I'm actually thinking of using jquery lightbox to apply to all my images but I figured with jquery lightbox I should at least make a page with all thumbnail images. So I'm trying to think of a way to easily bring out all the images in the folder+subfolders, but somehow I'm searching through sites/goolging most of them only talk about scandir and glob. I tried something like... foreach (glob("*.png") as $filename) { echo "$filename size " . filesize($filename) . "\n"; } but glob still doesn't go INTO sub directories same as for scandir... I can do the same code few times to check each sub directories but it'll be a annoying to do so... $image_files = scandir("./images/"); I thought of doing the code above and sub a variable into ./images/variable within a loop or something but somehow I just can't get outside the box and get it to work... anyone able to give me a hint or give me a hand? Thanks in advance...
  • 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.