DPChallenge: A Digital Photography Contest You are not logged in. (log in or register
 

DPChallenge Forums >> General Discussion >> web building question
Pages:  
Showing posts 1 - 25 of 28, (reverse)
AuthorThread
07/14/2003 01:21:24 PM · #1
I'm putting together an automatic gallery system and have a question about the best approach to dynamically create an index page.

I currently have an arbitrary number of gallery subdirectories

gallery1
gallery2
gallery3
.
.
.
galleryn

Each gallery has an index.htm page and I want to at the next level up, create another index page that contains links to each of these galleries. As I will be frequently adding new galleries, I'd prefer not to have to update the index.htm page manually each time. I'm unsure what the best approach is to get a list of the gallery directories, and then generate the html for each link. Is it possible to do this dynamically within javascript in the index.htm page, or do I have to write some sort of simple server side generator that gets the directory listing and interates through the gallery* list ?

Database approaches seem like overkill, for what is essentially a simple ls and loop operation.
07/14/2003 01:57:55 PM · #2
Javascript is client-side only, so that won't work.

What server-side languages do you have available?

This is a super easy job for Perl or a Unix shell.
07/14/2003 02:00:04 PM · #3
Originally posted by Gordon:

I'm putting together an automatic gallery system and have a question about the best approach to dynamically create an index page.


To me it seems that you answered your own question:

"I'm putting together an automatic gallery system."

;)

(use the same programming language as your gallery software, then just query the database for the categories, and display these dynamically)

dpcman.gif - haje

Message edited by author 2003-07-14 14:00:21.
07/14/2003 02:01:06 PM · #4
Originally posted by Gordon:

Database approaches seem like overkill, for what is essentially a simple ls and loop operation.


Uhmm... So your galleries don't use a database?

I am confused...
07/14/2003 02:22:59 PM · #5
I'm using breeze browser to generate all of the galleries automatically. I use it to catalog the pictures, add additional comments, shooting notes etc, and then autocreate the thumbnails/ web display versions and create the html pages from a template.

I'm doing this for multiple collections of pictures, that I am having put into these various gallery directories.

I am just wanting to tie them all together at the next level up with a index page, that doesn't require links to be manually updated each time I add a new gallery.

From what I can tell, the simplest way is just going to be to write a python script to generate the index page. I want to have this as both a web site and also distributable on a CD, so any server side scripting languages aren't suitable. I wasn't sure if there were any approaches that would allow the page to dynamically build, without knowing how many gallery directories there were. I guess there aren't any that don't require a server to execute the code.

Unless there was a javascript way to ask 'does this other page exist' which would be all I needed.

Message edited by author 2003-07-14 14:24:01.
07/14/2003 02:31:01 PM · #6
One of the photo sites I maintain uses php to automatically generate the front page based on the file folders that are beneath it. I didn't write the script so I don't know jack about it, but maybe that's a possibility?
07/14/2003 02:35:14 PM · #7
Originally posted by mk:

One of the photo sites I maintain uses php to automatically generate the front page based on the file folders that are beneath it. I didn't write the script so I don't know jack about it, but maybe that's a possibility?


It would be, but wouldn't work on a CD (as it requires a server to run the PHP code, to generate the actual HTML on the fly)

I think basically I cant do this in any client side language, so I'm just going to do it ahead of time with a script.
07/14/2003 03:11:06 PM · #8
I am not shure if this is the answer you are looking for, but how about including the site index in an IFrame on all the pages, that way you only have to update one file. It only works in IExplorer though.
07/15/2003 05:26:09 PM · #9
I would suggest using a loop in PHP, and loading the images into an array from using a file command to get the directory contents. You could use a string function to make sure that you the last four characters in the filename that you are returning would be .jpg or whatever you want.

I hope this helps a little bit. Of course I wouldn't just dive in if you don't know what you are doing. You are going to have to do some reading and messing around before so you learn how to do everything. That is if you are new to web programming.
07/15/2003 05:40:47 PM · #10
Again, unfortunatly PHP requires a server, so it isn't going to help for a CD based version of the site. I gave up on trying to use any kind of clever web technology and just wrote a python script to pull it together. I was hoping that there would be some sort of client side type of solution but all I could come up with would be passing the number of galleries as a parameter to the index page
07/15/2003 05:47:57 PM · #11
Originally posted by Gordon:



It would be, but wouldn't work on a CD (as it requires a server to run the PHP code, to generate the actual HTML on the fly)

I think basically I cant do this in any client side language, so I'm just going to do it ahead of time with a script.

Is there any free server software you could include on the CD?

If you're burning a CD, there's going to be a fixed number of galleries there. If you can run a server on your local machine, maybe you could use it to generate the index pages once you have your files/folders structured.

Or just copy/paste the links!
07/15/2003 08:01:48 PM · #12
Originally posted by GeneralE:

Originally posted by Gordon:



It would be, but wouldn't work on a CD (as it requires a server to run the PHP code, to generate the actual HTML on the fly)

I think basically I cant do this in any client side language, so I'm just going to do it ahead of time with a script.

Is there any free server software you could include on the CD?

If you're burning a CD, there's going to be a fixed number of galleries there. If you can run a server on your local machine, maybe you could use it to generate the index pages once you have your files/folders structured.

Or just copy/paste the links!


Actually, I am burning to a CD, but there is not a fixed number of galleries (I'm adding them as I go along, to a multi-session CD, so each time I need to also replace the index which is a pain)

I want the CD to work on Mac/ PC so any executables (i.e., distributing a server) doesn't work. Its trivial to build the index using a script, its just a pain I can't do it in the html or equivalent.
07/15/2003 11:42:11 PM · #13
Originally posted by Gordon:


Actually, I am burning to a CD, but there is not a fixed number of galleries (I'm adding them as I go along, to a multi-session CD, so each time I need to also replace the index which is a pain)

I want the CD to work on Mac/ PC so any executables (i.e., distributing a server) doesn't work. Its trivial to build the index using a script, its just a pain I can't do it in the html or equivalent.


It is not possible to run a "server" type application direct from a CDROM as others have suggested. It is also not possible (without heavy coding) to allow client side script to access the file structure (this would be a security risk because anyone could write client side script to go through your local hard drive and retrieve files).

This means that your only alternative is to overwrite the index html page each time you update a session on the CDROM. You could implement some strategies to generate that index file locally (running a non browser based script tool), but I cant suggest any easy ways to avoid updating the index file on CD each time.

Andrew
07/16/2003 09:18:16 AM · #14
Originally posted by andrewlr:

Originally posted by Gordon:


Actually, I am burning to a CD, but there is not a fixed number of galleries (I'm adding them as I go along, to a multi-session CD, so each time I need to also replace the index which is a pain)

I want the CD to work on Mac/ PC so any executables (i.e., distributing a server) doesn't work. Its trivial to build the index using a script, its just a pain I can't do it in the html or equivalent.


It is not possible to run a "server" type application direct from a CDROM as others have suggested. It is also not possible (without heavy coding) to allow client side script to access the file structure (this would be a security risk because anyone could write client side script to go through your local hard drive and retrieve files).

This means that your only alternative is to overwrite the index html page each time you update a session on the CDROM. You could implement some strategies to generate that index file locally (running a non browser based script tool), but I cant suggest any easy ways to avoid updating the index file on CD each time.

Andrew


Thank you Andrew, that is pretty much the conclusion I came to as well. I'm just using a python script to generate the index file each time I want it. Works but a shame I couldn't integrate it more smoothly.
07/16/2003 09:58:05 AM · #15
You might have already tried this but Google for "Javascript Image Gallery" and see if one fits your need :)
07/16/2003 10:05:19 AM · #16
Originally posted by tarique:

You might have already tried this but Google for "Javascript Image Gallery" and see if one fits your need :)


as discussed, javascript doesn't really meet this requirement, nor do any client side approaches
07/16/2003 11:42:25 AM · #17
How painful is it to replace the html file each time? I estimate it would take you less than 30 seconds to edit in notepad, add an a href and 5 seconds to drag the new html along with your new galleries to your burning software.

If your gallery list changes often, you could set up your site in dreaweaver, frontpage, etc.. so that adding/removing gallery indexes will result in global link changes to the site. since you'll be burning a cd anyway to hold the new galleries, why not re-burn the entire site? your gallery can't be larger than a few hundred Mb and since time and effort are the issue, it's nice to know burning a 200 Mb gallery at 48x will take well under a minute.

If I were showing people a gallery, i'd not go the CD route. Why go technologically backward? I'd probably give them a card with my URL and have my gallery operate solely online. Sure, having an offline version of your updated gallery benefits those without connection, but what of the poor internet viewers like myself and the millions of others!!

On a side note, client side file system access by client side scripts doesn't require heavy coding. and your browsers prompt you (yes/no) if you'd want to allow the script to access it or not (depending on your browser security level).

btw. what's python scripting?
07/16/2003 12:14:08 PM · #18
Originally posted by roleychiu:

How painful is it to replace the html file each time? I estimate it would take you less than 30 seconds to edit in notepad, add an a href and 5 seconds to drag the new html along with your new galleries to your burning software.

If your gallery list changes often, you could set up your site in dreaweaver, frontpage, etc.. so that adding/removing gallery indexes will result in global link changes to the site. since you'll be burning a cd anyway to hold the new galleries, why not re-burn the entire site? your gallery can't be larger than a few hundred Mb and since time and effort are the issue, it's nice to know burning a 200 Mb gallery at 48x will take well under a minute.

If I were showing people a gallery, i'd not go the CD route. Why go technologically backward? I'd probably give them a card with my URL and have my gallery operate solely online. Sure, having an offline version of your updated gallery benefits those without connection, but what of the poor internet viewers like myself and the millions of others!!

On a side note, client side file system access by client side scripts doesn't require heavy coding. and your browsers prompt you (yes/no) if you'd want to allow the script to access it or not (depending on your browser security level).

btw. what's python scripting?


I'm providing CDs with maybe up to 50 galleries on them. (that's about 25 minutes right there by your estimation - and I'm producing different ones each time) So it is a pain to edit in each link each time, when I already know exactly what the link is going to be, and when everything else is automatically produced from the initial set of images and directories.

The directories also hold full resolution proofs of the images, available for print usage. This means that each directory can be upwards of 300Mb, so I'll probably end up using DVDs for some of these anyway.

I also post everything bar the proof directories on-line for access on occassion, so I was looking for an approach that would work effortlessly both ways.

Can you explain how to do script access to the filesystem ?

Everything I can find on the topic says this is impossible - mainly due to the sandbox design approach for these languages. All I need is a javascript way to get a directory listing of the directory the file is being served from (without running a server - as at least for the CD version I cant). From there it is trivial to generate the html for each of the n gallery directories.

Python is a scripting language. It is like a more powerful version of PHP, roughly. Or a more readable version of Perl.

Message edited by author 2003-07-16 12:14:58.
07/16/2003 12:44:01 PM · #19
Originally posted by Gordon:

Originally posted by tarique:

You might have already tried this but Google for "Javascript Image Gallery" and see if one fits your need :)


as discussed, javascript doesn't really meet this requirement, nor do any client side approaches

Well JavaScript could have worked as local files are allowed to access local files ;)

What wrong with your python script?

There was a script called igal - don't recall the URL which when presented directories full of images would create static HTML pages and thumbnails - but that was Linux + perl - what platform you are on?

If nothing really works - I will whip up a PHP script for you to create static HTML. You got PHP?
07/16/2003 02:10:42 PM · #20
Originally posted by tarique:



What wrong with your python script?


Nothing, it just has to be run manually each time I add new galleries, and doesn't work on a CD, without re-writing the index each time. It works, but it offends my sense of simplicity.

Javascript wont work as I think you are mixing up the idea of client and server, even when they are on the same machine, unless you can show me how to write client side javascript (i.e., the stuff that is imbedded in an html file) that can read a directory - if you can great - that's all I'm looking for.

The PHP script would no doubt look very much like the python script, PHP is basically a subset of the functionality of python as far as I could see. What you describe whipping up to create a static html file is what I am already currently doing in python, its only a few lines of code.

Message edited by author 2003-07-16 14:11:48.
07/16/2003 02:21:52 PM · #21
Gordon -

If you're primarily targetting windows platforms, you may want to take a look at HTAs. Basically, HTML files that run in the local security zone and have access to the file system and registry. I haven't read too much about it, but I would guess you could extend it with ActiveX or JavaScript to do what you want to.

More info.
07/16/2003 02:24:57 PM · #22
Originally posted by mci:

Gordon -

If you're primarily targetting windows platforms, you may want to take a look at HTAs. Basically, HTML files that run in the local security zone and have access to the file system and registry. I haven't read too much about it, but I would guess you could extend it with ActiveX or JavaScript to do what you want to.

More info.


Thanks for the info, unfortunately, as I think I said earlier in this thread I want to index to work in at least 3 cases : standard web site, CD used on a PC and CD used on a Mac. I've pretty much come to the conclusion that there isn't a browser based technology that will let me do this in an elegant manner, so I'm happy with the simple script based solution that I have. Its more maintenence work than if it was automatic, but it isn't too big a deal.
07/16/2003 02:48:21 PM · #23
I haven't read all the replies but being a programmer (web and distributed) by trade I can tell you that your solution depends almost wholly on the server your website (or at least the pictures) is hosted on.

If you're on a Linux box, you'll more than likely be writing PHP scripts. If you're on a Microsoft box, then you'll probably be writing ASP scripts (hint - on this box try using the Scripting runtime and use Scripting.FileSystemObjects to access the child folders and contact sheets).

At last, something I can contribute to technically. If you want more direct help, feel free to send me a private message from my profile. This is the kind o' stuff I do all day long.
07/16/2003 02:51:55 PM · #24
Originally posted by KevinRiggs:

I haven't read all the replies but being a programmer (web and distributed) by trade I can tell you that your solution depends almost wholly on the server your website (or at least the pictures) is hosted on.

If you're on a Linux box, you'll more than likely be writing PHP scripts. If you're on a Microsoft box, then you'll probably be writing ASP scripts (hint - on this box try using the Scripting runtime and use Scripting.FileSystemObjects to access the child folders and contact sheets).

At last, something I can contribute to technically. If you want more direct help, feel free to send me a private message from my profile. This is the kind o' stuff I do all day long.


Thanks for the reply Kevin, but if you'd read a bit further you'd realise that partly this is to also work on a CD, so server based solutions don't work at all.
07/16/2003 05:05:22 PM · #25
Originally posted by Gordon:



Can you explain how to do script access to the filesystem ?


Javascript can access the file system for IE4+ through filesystemobject and activeX objects. You'll be accessing your own filesystem, so you can ignore the warning that pops up saying a malicious script is trying to access the system. Alternatively you can uncheck the option to prompt for activex script prompting and you'd avoid the warning

Here's a primer:
//www.webreference.com/js/column71/

The filesystem objects and functions can give you the directory information you require.

Any questions let me know.
Pages:  
Current Server Time: 06/20/2019 01:57:41 AM

Please log in or register to post to the forums.


Home - Challenges - Community - League - Photos - Cameras - Lenses - Learn - Prints! - Help - Terms of Use - Privacy - Top ^
DPChallenge, and website content and design, Copyright © 2001-2019 Challenging Technologies, LLC.
All digital photo copyrights belong to the photographers and may not be used without permission.
Proudly hosted by Sargasso Networks. Current Server Time: 06/20/2019 01:57:41 AM EDT.