We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Photo album script
Topic Started: May 26 2005, 04:10 PM (959 Views)
Jory
Member Avatar
Member
[ *  *  *  *  *  * ]
Hey, I made a photo album script.
script in action
script scource

Any comments on is, ways to make it faster etc?
(Because I find it verry slow, though working with files is always slow)

Is is ment to be so that there is verry litle maintanence.
(Upload the picts, ad a link to the begin view and you're done.)
I want to keep it that way :)


Anyway: what do you people think?

(Know its not really a hard thing to make, but its the hardest thing I've made this far so give me a break :P )

:twitch:
Offline Profile Quote Post Goto Top
 
Rory
i;m a mess
[ *  *  *  *  *  *  * ]
You could re-write it to browse through an /albums/ directory, and get a list of all the folders beneath that.

That way you don't need to manually add links to new albums etc. and then if you have done that, it is easy to check whether a directory exists, and if it doesn't, you can print a nice error message rather than the ugly php error you get now.

Look up opendir(), readdir() and closedir() for more information about looking at what files's and folders are within a main directory.
Offline Profile Quote Post Goto Top
 
Jory
Member Avatar
Member
[ *  *  *  *  *  * ]
But then, how would you give the link a name?
(Because just letting the link have the name the directorie has would not give you pretty names :P )


And I do know opendir(), readdir() and closedir() <_<
(Only one I didn't use was closedif() and thats just because I didn't feel like doing more work on it once it was all error free)

And the error thing:
Working on that, though I don't think anybody would even go there because they have nice little links to click on :P
Offline Profile Quote Post Goto Top
 
Rory
i;m a mess
[ *  *  *  *  *  *  * ]
Well, if you name the directory's names such as:

/18th_birthday_party/

you could use replace the _'s with spaces for the link text, if you get me. All you'd need to do is a loop through the directory's echoing out a link.

@ the opendir() etc. comment, my bad, didn't read the code properly :P
Offline Profile Quote Post Goto Top
 
Jory
Member Avatar
Member
[ *  *  *  *  *  * ]
Guess I could do that, yes.
Nice idea :)
Also added closedir() to the script (didn't upload it yet).
Guess you should put that in :P

And did the checking if the dir is there to stop ugly errors.

Anyway, thnx for the comments Rory :)
Offline Profile Quote Post Goto Top
 
Rory
i;m a mess
[ *  *  *  *  *  *  * ]
Not sure how you could do it, because the images aren't in a database or anything (are they?), but perhaps limiting the number of images on a page to 15 or something, then having Page 1 2 3 ... 9 or something?
Offline Profile Quote Post Goto Top
 
solinent
Member
[ *  *  * ]
a bit off topic..but here i go

First of all, couldn't you do this easy with javascript?

Second of all, YOU USE BAD WORDS!!! lol :P
Offline Profile Quote Post Goto Top
 
Rory
i;m a mess
[ *  *  *  *  *  *  * ]
Probably not with Javascript, because there is no way of getting the files from within the directory.
Offline Profile Quote Post Goto Top
 
Jory
Member Avatar
Member
[ *  *  *  *  *  * ]
solinent
May 28, 2005 02:19 AM
Second of all, YOU USE BAD WORDS!!! lol :P

:huh:

What do you mean?


And like Rory said: JS won't let you check out the directories.
You would need something serverside (and only serverside language I know is PHP (know as in know how to use it) )
Offline Profile Quote Post Goto Top
 
solinent
Member
[ *  *  * ]
In your commenting lol :)

Ok, sry bout that didn't know exactly how the script worked. You can do it however though. (Tell me what won't work and i'll come up with it)

Also I don't use php much, as most of my site is built in asp(only cause I didn't have php available at first, but now I do :))
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Technology Chat · Next Topic »
Add Reply