/    Sign up×
Community /Pin to ProfileBookmark

Dynamic Gallery and PopUp Gallery

So yes, what I am trying to do is have my website be totally dynamic. I want to upload images or text files, and have the website automatically update itself. I am doing this for a gallery page with thumbnails. I want it to pull images from a folder and sort the images by date.

Also, the hard part is that I want these thumbnails to link to a single PHP file that will populate a predetermined page-layout with images and text based upon contents of a folder.

The obstacle I am trying to overcome is having each thumbnail on the main gallery page all know to use the PHP file, but then know to go to a certain folder to load in images.

I don’t understand how I would make each link point to the same PHP file, but then have the php file know what thumbnail I clicked.

If someone can help me, that would be a huge help. This is the biggest road block, and I think I can figure the rest of it out.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@SyCoDec 14.2007 — The simplest solution that I can think of is on upload, store image data like name, folder etc in a table stored with an ID to use as a reference.

Attach that id to the thumbnail source so the href/image source could be something like

thumbnail.php
[code=php]q="select * from thumbsdata";//or however you generate your thumbs
$r=mysql_query($q);

while($row=mysql_fetch_assoc($r){
//format however
echo "<a href="display.php?id=".$row['imageid']."><img src="thumbnail".$row['thumb_id'].".jpg" border=0></a>";
}
[/code]

and display.php
[code=php]q="select * from imagedata where id=".$_GET['id'];
$r=mysql_query($q);
$row=mysql_fetch_assoc($r);

echo "<img src="".$row['foldername']."/".$row['imagename'].".jpg">";[/code]


You can use functions like glob() or opendir()/isdir() to create a folder browsing interface to upload images to particular folders. Then when you choose to upload, store the folder path and other image data in your database.
×

Success!

Help @DemonWulf spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...