Generation of static site (e.g. for burning on a CD)

cal

Joined: 2002-08-20
Posts: 6
Posted: Tue, 2002-08-20 20:49

Hi all. Gallery is a wonderful system for organizing and sharing images! I've recommended it to many.

One thing that I would find very useful would be the ability to make a CD of a site so that I can distribute my images to people without internet connections. I haven't seen this implemented anywhere -- can this be done in Gallery?

 
vallimar

Joined: 2002-08-15
Posts: 487
Posted: Wed, 2002-08-21 08:17

Hmm, dunno how well it would work, but if you have access to *nix
you could try using 'wget' to create a local mirror site and such, this
might generate a static version of the site at the time that you could
burn to a CD. Just make sure you test it first.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Wed, 2002-08-21 17:49

Good suggestion, vallimar. Another thing you can do is to use the GalleryXML add on from the <!-- BBCode Start --><A HREF="http://gallery.sourceforge.net/wiki.php?page=Contributed%20Code" TARGET="_blank">Contributed Code</A><!-- BBCode End --> page.

 
TheWatcher
TheWatcher's picture

Joined: 2002-08-21
Posts: 120
Posted: Wed, 2002-08-21 18:40
Quote:
Hi all. Gallery is a wonderful system for organizing and sharing images! I've recommended it to many.

One thing that I would find very useful would be the ability to make a CD of a site so that I can distribute my images to people without internet connections. I haven't seen this implemented anywhere -- can this be done in Gallery?

That is a great suggestion, where you can copy a lightweight version of gallery with all selected pictures or entire sites...

I will look into this, i hope my day time job will not interfere.

 
vallimar

Joined: 2002-08-15
Posts: 487
Posted: Sat, 2002-08-24 12:09

Ahhh, I totally forgot about that XML code, thanks for the reminder.

 
cal

Joined: 2002-08-20
Posts: 6
Posted: Sun, 2002-08-25 22:58

Thanks for the advice. I've downloaded the gallery2xml script and when I run it on an album called family, I get:

$ ./gallery2xml -b /usr/local/gallery/albums -o gallery.xml family
Parsing family
Can't use string ("<null>") as a HASH ref while "strict refs" in use at ./gallery2xml line 323.

Before I delve into the perl, can anyone shed some light on this?

Quote:
Good suggestion, vallimar. Another thing you can do is to use the GalleryXML add on from the <!-- BBCode Start --><A HREF="http://gallery.sourceforge.net/wiki.php?page=Contributed%20Code" TARGET="_blank">Contributed Code</A><!-- BBCode End --> page.

 
skaffen

Joined: 2002-09-06
Posts: 6
Posted: Sun, 2002-09-08 08:16

Great thing with burning the CD, I also want to do that and found this forum entry.

Any luck so far?

I'll also give it a shot later on today, my wife is an xml developer, maybe she can help. Though I'd prefer the wget option, did anyone have success with that? It'd be easier to script into an easy to use standalone script I could give to my users at work.

Andreas

 
skaffen

Joined: 2002-09-06
Posts: 6
Posted: Sun, 2002-09-08 09:14
Quote:
Hmm, dunno how well it would work, but if you have access to *nix
you could try using 'wget' to create a local mirror site and such, this
might generate a static version of the site at the time that you could
burn to a CD. Just make sure you test it first.

OK, my xml-attempts were not successful but before I delved too deeply into that I gave wget a shot. The following command worked AFAICT:

wget -rEkmpD http://www.ikm.uni-karlsruhe.de http://www.ikm.uni-karlsruhe.de/gallery/

I never worked with wget before and I just skimmed the *huge* manpage, if anyone has more experience with wget, feel free to jump in and point out errors/optimizations.

The only thing that doesn't seem to work is the slide show and login stuff, I might write a sed script some time to remove that from the html so that people don't accidentally click on it when I burn it on CD. Again any suggestions in that regard are greatly appreciated.

Andreas

 
cal

Joined: 2002-08-20
Posts: 6
Posted: Sun, 2002-09-08 15:14

Thanks for the wget tip -- I had been unable to get it to work satisfactorily for me.

Instead, I have been working with Norman Walsh, who contributed the gallery2xml script, and some associated files. These are in the Contributed Code section. We found some typos and small problems. I hope that we can update the previously-contributed code soon.

At this point, and perhaps you or your XML-savvy spouse can help here, I have a small problem with the presence of nonstandard characters bombing the XML processor (I'm using saxon). For now, I've resorted to simply removing the offending characters, but I'm looking for a better way. In particular, I think that I need a perl module which can translate arbitrary text into saxon-compatible text. Please let me know if you're interested in helping -- I can be much more specific with the error messages and provide files which cause the problem to occur.

Short answer: stay tuned. Long answer: stay tuned and I can really use a little help.

Charles

Quote:
.
.
.
OK, my xml-attempts were not successful but before I delved too deeply into that I gave wget a shot. The following command worked AFAICT:

wget -rEkmpD http://www.ikm.uni-karlsruhe.de http://www.ikm.uni-karlsruhe.de/gallery/
.
.
.

 
skaffen

Joined: 2002-09-06
Posts: 6
Posted: Sun, 2002-09-08 20:31
Quote:
Thanks for the wget tip -- I had been unable to get it to work satisfactorily for me.
[/quote}

Try it, I think it'll be much easier than messing around with the xsl... :smile:

Quote:
At this point, and perhaps you or your XML-savvy spouse can help here, I have a small problem with the presence of nonstandard characters bombing the XML processor (I'm using saxon). For now, I've resorted to simply removing the offending characters, but I'm looking for a better way. In particular, I think that I need a perl module which can translate arbitrary text into saxon-compatible text. Please let me know if you're interested in helping -- I can be much more specific with the error messages and provide files which cause the problem to occur.

I think this might be a bug we also had, we tried to put some additional headers into the files for character support (don't ask me, I have no clue about XSL/XML) and after some time we gave up. My wife isn't familiar with Saxon, they have some custom stuff she's using at her orkplace on but these wouldn't work in this case.

I really have no idea about XML and I'm out of my depth here :sad: , for now I think that wget is the easier solution by far, especially for setting up scripts for people that don't know much about command lines. I really can't help with the xml and she's not too interested in it especially now that we have a working solution.

Sorry, I'll get back to you if I get around to fully automating it with wget, especially taking out unwanted links and doing some tests with CDs on not-networked computers.

Andreas

 
vallimar

Joined: 2002-08-15
Posts: 487
Posted: Sun, 2002-09-08 20:34

Glad to see people are using wget, I just threw that out there as a suggestion
as when I need to grab a website it's my tool of choice. I haven't actually tried
it on Gallery yet as I've had no need. If anyone with a working setup could
post some working examples of calling usage and maybe even some scripts
that could be incorporated into the user guide, please do!

 
gomiboy

Joined: 2002-09-08
Posts: 14
Posted: Tue, 2002-09-10 17:55

I'm trying to run wget on the same box that hosts gallery. Does anyone know if there's a way to point wget to the actual files, rather than a URL? I tried file:// for the URl, but got an error about unsupported protocol.

I have some firewall configuration weirdness that prevents the box from accessing itself from the same URL as outside. Gallery is configured with the outside URL, so wget bombs out after fetching index.php.

Thanks,
Chris

 
vallimar

Joined: 2002-08-15
Posts: 487
Posted: Wed, 2002-09-11 08:26

In a case like that, I'm not sure there is much you can do.
You'll have to either alter your firewall, temporarily change
the gallery configuration, or run wget from another machine.

But I'm no expert, there very well be away, I just can't think
of one offhand.

 
gomiboy

Joined: 2002-09-08
Posts: 14
Posted: Wed, 2002-09-11 16:08

OK, I fixed the cofig problem (found the problem on the server, not the firewall) and got wget to convert gallery/index.php, but it says "nothing to do" and stops after that file. I can load the index.php.html file that it creates &amp; it looks fine, but the pictures are links out to the webserver, not static files.

I tried pointing wget at one of the albums &amp; had the same result. I tried another plain html site (virtual hosts) on the same box &amp; it worked fine.

I'm using wget -rEkmpD etc.

Anyone have any ideas why it stops?

Thanks,
Chris

 
gomiboy

Joined: 2002-09-08
Posts: 14
Posted: Wed, 2002-09-11 17:28

OK, I'm an idiot. I had a robots.txt file that makes it stop.

I had to point wget to http://..... gallery/index.php to make it work.
I also had to specify l=10 (recursion depth) to get all the nested albums &amp; albums with more than a couple of pages.

Thanks for the pointer to wget. I was having a lot more trouble with the xml scripts.

Chris

 
Hurricane_GS

Joined: 2002-09-12
Posts: 1
Posted: Thu, 2002-09-12 13:29

I tried it last night with a program called Teleport Pro and it worked like a champ! There is an option when creating the image that you select to "Create a browsable copy of a website on my hard drive." Then once it pulls it to the drive you can burn it to CD. Worked nice!

The program is available at http://www.tenmax.com/teleport/pro/home.htm although it is not free. :???:

I hope this helps!

 
Kaballz

Joined: 2002-09-09
Posts: 4
Posted: Fri, 2002-09-13 22:09
Quote:
OK, I'm an idiot. I had a robots.txt file that makes it stop.

Hehe.. I hacked my wget to get rid of that robots.txt "feature". :lol:

 
cal

Joined: 2002-08-20
Posts: 6
Posted: Thu, 2002-09-19 03:03

Dear Andreas (and whoever else may be interested) --

I've been working with Norman Walsh for the last week or so trying to update the gallery2xml and associated scripts. I think we have a fully-functional method to generate a static album. The scripts can be fetched from http://nwalsh.com/hacks/gallery/index.html

Here's a very-very short HOW-TO (for linux/unix users):

1. make sure that you've got the saxon XSLT processor installed and that it's called 'saxon' and is in your $path.

2. download the scripts (<!-- BBCode Start --><A HREF="http://nwalsh.com/hacks/gallery/gallery2xml" TARGET="_blank">gallery2xml</A><!-- BBCode End -->,
<!-- BBCode Start --><A HREF="http://nwalsh.com/hacks/gallery/duptree.xsl" TARGET="_blank">duptree.xsl</A><!-- BBCode End -->, <!-- BBCode Start --><A HREF="http://nwalsh.com/hacks/gallery/htmltree.xsl" TARGET="_blank">htmltree.xsl</A><!-- BBCode End -->, and <!-- BBCode Start --><A HREF="http://nwalsh.com/hacks/gallery/make_static_gallery.csh" TARGET="_blank">make_static_gallery.csh</A><!-- BBCode End -->). Give executable permissions to gallery2xml and make_static_album.csh.

3. run make_static_album.csh and answer the questions.

More detailed instructions (even better, follow the directions on Norman Walsh's page):

1. get the following scripts from Norman Walsh's web site: <!-- BBCode Start --><A HREF="http://nwalsh.com/hacks/gallery/gallery2xml" TARGET="_blank">gallery2xml</A><!-- BBCode End -->,
<!-- BBCode Start --><A HREF="http://nwalsh.com/hacks/gallery/duptree.xsl" TARGET="_blank">duptree.xsl</A><!-- BBCode End -->, <!-- BBCode Start --><A HREF="http://nwalsh.com/hacks/gallery/htmltree.xsl" TARGET="_blank">htmltree.xsl</A><!-- BBCode End -->, and <!-- BBCode Start --><A HREF="http://nwalsh.com/hacks/gallery/make_static_gallery.csh" TARGET="_blank">make_static_gallery.csh</A><!-- BBCode End -->.

2. ensure that you have a functional XSLT processor. I've had good luck with <!-- BBCode Start --><A HREF="http://saxon.sourceforge.net/" TARGET="_blank">saxon</A><!-- BBCode End --> and <!-- BBCode Start --><A HREF="http://www.gingerall.com/charlie/ga/xml/d_sab.xml" TARGET="_blank">sablotron</A><!-- BBCode End -->. For the record, I'm using Linux Red Hat 7.1.

3. you need read-access to the files in your album and write permissions in the directory where you would like to create the static album. Make the gallery2xml script executable. This will work under unix/linux: <!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>chmod 755 gallery2xml</TD></TR></TABLE><!-- BBCode End -->

4. run the gallery2xml script to generate an XML file from your album.dat file. Run it like this: <!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>./gallery2xml -b /path/to/album/directory -o album.xml album_name</TD></TR></TABLE><!-- BBCode End -->

5. you can create a script to copy the image files into your target directory like this (I'm assuming you're using saxon; the sablotron syntax is a bit different): <!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>saxon album.xml duptree.xsl base=/path/to/album/directory/ root=/path/to/target/directory/ > copy_files.sh</TD></TR></TABLE><!-- BBCode End --> You will need the trailing slashes on the directory paths.

6. Don't forget to create the target directory before running the script like this: <!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>sh copy_files.sh</TD></TR></TABLE><!-- BBCode End -->. This should make all of the proper subdirectories and copy the images into them.

7. Create the HTML files like this (again, assuming saxon usage): <!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>saxon album.xml htmltree.xsl base=/path/to/target/directory/</TD></TR></TABLE><!-- BBCode End -->

8. You will probably wish to copy your $GALLERY_HOME/images directory into your target directory for the little GIF files like arrows, etc. Of course, $GALLERY_HOME may be /usr/local/gallery or some other location, depending on your Gallery setup. Also, you may wish to copy a stylesheet from $GALLERY_HOME/css into a file called album.css in your target directory. Finally, I like the idea of creating a main index.html file which redirects you to the album's index.html.

 
gomiboy

Joined: 2002-09-08
Posts: 14
Posted: Tue, 2002-10-01 03:46

Teleport doesn't work with URL's that specify a port nuber (ie http://www.foobar.com:8000/).

:cry:

 
gomiboy

Joined: 2002-09-08
Posts: 14
Posted: Tue, 2002-10-01 04:30

I used wget on a redhat box to generate a static page. Then I zip it up, transfer it all over to my windows PC, unzip, burn it on a CD, and view with Mozilla 1.2a.

The first page of every album works fine, but the links to the later pages look something like:
file:///D:/Temp/gallerycd/modules/gallery/album01?&amp;page=6.html.
BUT the file is actually named album01_&amp;page=6.html (_ not ?). It also happens with some image filenames.

It looks like unix zip or windows winzip 8.0 is munging the file names.

If anyone else if having this problem I wrote a sed script that changes the html code to match the file names.

#! /bin/sh
# fix a file naming bug
find modules -type f -name '*.html' -print | while read i
do
sed 's|%3F|_|g' $i > $i.tmp &amp;&amp; mv $i.tmp $i
done