# "dynamic" picture gallery

**URL:** <https://forum.kirupa.com/t/dynamic-picture-gallery/14365>\
**Category:** programming\
**Created:** [February 25, 2003, 4:18pm UTC](https://forum.kirupa.com/t/dynamic-picture-gallery/14365 "2003-02-25T16:18:15Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![digiphoto](https://avatars.discourse-cdn.com/v4/letter/d/96bed5/32.png) [@digiphoto](https://forum.kirupa.com/u/digiphoto)\
**Post date:** [February 25, 2003, 4:18pm UTC](https://forum.kirupa.com/t/dynamic-picture-gallery/14365/1 "2003-02-25T16:18:15Z")

</div>

hey guys

I checked out [kirupa.com](http://kirupa.com)’s Picture Gallery tutorial which was cool.

Unfortunately it uses an array of specific images in a folder. How about searching for all JPG files in a particular folder, get the number of files and load these pictures.

Wishful Scenerio:  
1- design a Flash Gallery.  
2- write a backend script or two.  
3- Upload the script and flash to server.  
4- Take 10 pics today. Upload them to pics/ folder.

and the script tells Flash there are 10 images and Flash displays 10 thumbnails (or whatever).  
The next day I may take 5 pictures. Upload 5 new pictures.  
And the Flash file automatically knows there are 15 files in a folder.

So basically, I won’t be touching Flash or script for a long time. 😃

Any ideas, pointers, etc.?

cheers in advance. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 25, 2003, 8:57pm UTC](https://forum.kirupa.com/t/dynamic-picture-gallery/14365/2 "2003-02-25T20:57:59Z")

</div>

Well… Doesn’t sound that bad…

have server side script generate the text file everytime Flash asks to do the gallery thing…  
Have your Flash movie read the text file that has certain format with the number of images and file names and such…

So… First step will be modifying Kirupa’s tutorial to read the text file and convert it to the array so that it will work the same way… Once that’s done, you can generate the server side script that will create the text file…

What do you think??? =)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 4, 2003, 4:07pm UTC](https://forum.kirupa.com/t/dynamic-picture-gallery/14365/3 "2003-03-04T16:07:23Z")

</div>

now that is an idea, CyanBlue.

I will have to read up some info on generating a text file based on JPG files…

Any pointers or suggestions RE objects, class or whatever (keywords, etc.) so that I can search and find more about it.

thanks man.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 4, 2003, 8:01pm UTC](https://forum.kirupa.com/t/dynamic-picture-gallery/14365/4 "2003-03-04T20:01:17Z")

</div>

reads all files in a folder and returns their details…:

```php
<?php
$dir = opendir(".");
while($file = readdir($dir)){
if($file=="." or $file=="..") continue;
$dotposition = strrpos($file, ".");
$filename = substr($file, 0, $dotposition);
$extension = substr($file, 1 + $dotposition);
if($extension == "jpg" || $extension == "gif"){
$size = getImageSize($file);
echo "$filename.$extension height = $size[1] width = $size[0] <BR>";
}
}
?>
 

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 4, 2003, 8:02pm UTC](https://forum.kirupa.com/t/dynamic-picture-gallery/14365/5 "2003-03-04T20:02:48Z")

</div>

hehe that looks familiar eyez 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 4, 2003, 10:19pm UTC](https://forum.kirupa.com/t/dynamic-picture-gallery/14365/6 "2003-03-04T22:19:28Z")

</div>

could’ve posted good ole “search” button again, but just had the php handy 😏

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 4, 2003, 11:29pm UTC](https://forum.kirupa.com/t/dynamic-picture-gallery/14365/7 "2003-03-04T23:29:08Z")

</div>

Yeah I do it too 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 5, 2003, 10:55am UTC](https://forum.kirupa.com/t/dynamic-picture-gallery/14365/8 "2003-03-05T10:55:30Z")

</div>

eyezberg,  
cheers for the code – although it is PHP (I use ASP) but it should not be too difficult to “convert” your code to ASP.

With my limited knowledge of PHP, how does your code work? I don’t see a text file being saved (containing a list of these image files)…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 11, 2003, 10:17pm UTC](https://forum.kirupa.com/t/dynamic-picture-gallery/14365/9 "2003-03-11T22:17:10Z")

</div>

I JUST made what you were talking about yesterday. Odd coiencidence, but here is my semi-finished version:

[http://www.askthefool.com/apple](http://www.askthefool.com/apple)

Still working on it, but currently its fully dynamic. I add pictures and run a C++ program which auto generates the thumbnails. Let me know what you think : )

Now i just have to get this swf, to be dynamic depending on the location I give it. I have tons of albums, and I don’t want to have to have seperate swf’s for each album or everytime I add a album.
