Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 136,070 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,607 people online right now. Registration is fast and FREE... Join Now!




Creating A Simple Image Gallery... Can You Help?

 
Reply to this topicStart new topic

Creating A Simple Image Gallery... Can You Help?

Markp
5 Sep, 2002 - 02:09 PM
Post #1

D.I.C Head
**

Joined: 18 Jan, 2002
Posts: 76

Please view my current gallery: http://www.markp.com/photos

I don't want to change the design, or feel I just want to make it simpler for me to upload images.

My directory structure is: Photos/PhotoSetName/TN

Photos is the main photo directory
PhotoSetName is the different photos i.e. newcastle03sept02
TN is the thumbnails directory for the above directory

Basically I want to drop a php file in the TN directory that reads all the files in that directory. Then links to the main file in the directory above when you click on the thumbnail.

I don't know where to start. Can anyone help?
User is offlineProfile CardPM
+Quote Post

supersloth
RE: Creating A Simple Image Gallery... Can You Help?
5 Sep, 2002 - 09:00 PM
Post #2

serial frotteur
Group Icon

Joined: 21 Mar, 2001
Posts: 19,601



Thanked: 12 times
Dream Kudos: 2147483647
Expert In: being gentlemanly

My Contributions
i know gneato already has something very similar worked out, hopefully he'll see this in the next 24 hours, if not, i'll pm him. smile.gif
User is offlineProfile CardPM
+Quote Post

Markp
RE: Creating A Simple Image Gallery... Can You Help?
6 Sep, 2002 - 08:26 AM
Post #3

D.I.C Head
**

Joined: 18 Jan, 2002
Posts: 76

QUOTE(supersloth @ Sep 5 2002, 11:00 PM)
i know gneato already has something very similar worked out, hopefully he'll see this in the next 24 hours, if not, i'll pm him. smile.gif

pm him! pm him! pm him! pm him! pm him! pm him!
pm him! pm him! pm him! pm him! pm him! pm him!
pm him! pm him! pm him! pm him! pm him! pm him!
pm him! pm him! pm him! pm him! pm him! pm him!
pm him! pm him! pm him! pm him! pm him! pm him!
pm him! pm him! pm him! pm him! pm him! pm him!
pm him! pm him! pm him! pm him! pm him! pm him!

biggrin.gif biggrin.gif biggrin.gif
User is offlineProfile CardPM
+Quote Post

Markp
RE: Creating A Simple Image Gallery... Can You Help?
6 Sep, 2002 - 08:47 AM
Post #4

D.I.C Head
**

Joined: 18 Jan, 2002
Posts: 76

Ok I've been given this code:

CODE
<?php
echo "testing stuff<hr>";
$dir = "/Users/nucleuz/Sites/flashkit.com/dir/tm";
$handle = opendir($dir);
echo "directory=$dir<br>";
while (($file = readdir($handle))) {
   if(preg_match("/\.jpg$/", $file)) {
       $link = $file;
       $file = str_replace("_tm", "", $file);
       echo "<a href=\"../" . $file . "\">" . $link . "<br>\n";
   }
}
?>


but this has two problems, it adds images one on top of each other, which should be fixed by removing the <BR> and if I remove the string replace _tm thing that should work I think! Then all I need to do is add the frame target.

Hurray! No doubt I'll be back when I have problems! biggrin.gif

M
User is offlineProfile CardPM
+Quote Post

gneato
RE: Creating A Simple Image Gallery... Can You Help?
8 Sep, 2002 - 08:13 PM
Post #5

<title>Untitled Document</title>
*****

Joined: 3 Sep, 2001
Posts: 1,311

I have a script that creates the thumbnails on the fly. Currently designed for this directory structure...

/gallery/root/dir/
/gallery/root/dir/gallery_one/imagename.jpg
/gallery/root/dir/thumbs/THUMB_gallery_one_imagename.jpg

You call the script like this...
http://url.to.gallery/?gallery=gallery_one

It shows a list of the images

To see a thumb, you visit
http://url.to.gallery/?gallery=gallery_one...l=imagename.jpg
If the thumbnail file doesn't exist, the script creates it... if the thumbnail image has already been created, it uses the existing one... (e.g. the thumbs are cached)

for fullsize, it's
http://url.to.gallery/?gallery=gallery_one...e=imagename.jpg

Tell me if you want the source code. Send me a pm or something. I'll have to adapt the code.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 07:06PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month