You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Alex Batlin <al...@batlin.com> on 2004/11/21 09:15:05 UTC

XSL for Photo Gallery

I was looking for a photo gallery plugin for forrest. I found JAlbum, seems
a very nice GUI product, but I have not found an XSL that can be plugged in,
anyone seen one?


Re: XSL for Photo Gallery

Posted by Ross Gardler <rg...@apache.org>.
joerg+computer.forrest@pi5.physik.uni-stuttgart.de wrote:
> I once did a picture gallery for forrest. You can find the result at 
> http://schreibubi.pi5.physik.uni-stuttgart.de/gallery/lena/newcam/index.html
> 
> When the plugin system came around I've started to adapt it to the plugin 
> system, but never came around to finish it. It is almost working, but right 
> now I don't have the time to finish it, because I have to write my 
> PhD-Thesis. I've attached the last version to this e-mail.

I've created an issue with your attachments, if anyone finishes off this 
work please submit updates to that issue - see 
http://issues.cocoondev.org/browse/FOR-387

Instructions for building a plugin are at 
http://svn.apache.org/viewcvs.cgi/forrest/trunk/docs-author/content/xdocs/howto/howto-buildPlugin.xml?view=markup

Jorg - thanks for your donation, this is great (I have my first baby on 
the way in a week or two, I'll certainly finish the pluygin then if 
no-one else does).

Ross

Re: XSL for Photo Gallery

Posted by Ross Gardler <rg...@apache.org>.
Jörg Werner wrote:
> okay, you got me hooked up. I found some more time to hack on the gallery 
> plugin. It is now in a working state. You can download the plugin from 
> http://bodensee.pi5.physik.uni-stuttgart.de/~joerg/org.apache.forrest.plugin.gallery.zip .

Excellent, thank you very much I will take a close look soon and publish 
it on the Forrest plugin lists (you get a "gold star" for being the 
first non-committer to develop a plugin :-))

> The pictures are expected unter {project:content.xdocs}/gallery/** in the 
> folders preview, small, big. Since the gallery plugin uses request 
> parameters, it will only work as a webapp.

Hmmm... have to look into this, I can't think of any reason, off the top 
of my head why this need be the case. All we need to do is move the 
parameters into the URL and it will work in static mode too (I'm not 
suggesting you need to do this, you provided the start, others can polish).

> On a related note (see FOR-387), I 
> don't think that it does make sense to generate the necessary image files on 
> the fly. This costs a lot of processor cycles. Think about the overview page. 
> Scaling 20 pictures from a 5MP-Digikam to preview size takes around 15s, and 
> this for each page request. Scales computationally really great (but caching 
> would help...).

In dynamic mode Cocoon does some very agressive caching, however, the 
first page request would indeed be slow. I think the trick would be to 
augment Cocoons caching by having a generator that writes the files to 
disk in the structure your plugin expects. In static mode we would be 
writing the files to disk so no problem there.

> Right now I use a short bash script to do the 
> conversion a la: 
> 
> #!/bin/bash
> for i; do
>   echo -n "Converting:" $i "... ";
>   convert -size 100x100 $i -resize 100x100 preview/$i;
>   convert -size 400x400 $i -resize 100x100 small/$i;
>   convert -size 800x800 $i -resize 100x100 big/$i;
>   echo "done.";
> done
> 
> It is sufficient for my purposes.

Yes, I'll put this in the docs.

> Todo for the plugin:

I'll put these in the plugin status.xml file too.

> But since I really don't have time for this, I leave these exercises to the 
> reader (I really hate this sentence in textbooks, but it is fun to use it in  
> his own texts ;-) )

HeHe, I spent a couple of years as a University lecturer and grew to 
love that phrase - it really means "I have too much other stuff to do 
right now".

Good look with your Thesis.

Ross


Re: XSL for Photo Gallery

Posted by Jörg Werner <jo...@pi5.physik.uni-stuttgart.de>.
Hi Ross,

okay, you got me hooked up. I found some more time to hack on the gallery 
plugin. It is now in a working state. You can download the plugin from 
http://bodensee.pi5.physik.uni-stuttgart.de/~joerg/org.apache.forrest.plugin.gallery.zip .
The pictures are expected unter {project:content.xdocs}/gallery/** in the 
folders preview, small, big. Since the gallery plugin uses request 
parameters, it will only work as a webapp. On a related note (see FOR-387), I 
don't think that it does make sense to generate the necessary image files on 
the fly. This costs a lot of processor cycles. Think about the overview page. 
Scaling 20 pictures from a 5MP-Digikam to preview size takes around 15s, and 
this for each page request. Scales computationally really great (but caching 
would help...). The only other option I see is that in forrest run, the 
preview and small pictures are generated before the webapp is started. But I 
don't think cocoon has the ability to scale pictures built in (havn't found 
something in the docs...). Right now I use a short bash script to do the 
conversion a la: 

#!/bin/bash
for i; do
  echo -n "Converting:" $i "... ";
  convert -size 100x100 $i -resize 100x100 preview/$i;
  convert -size 400x400 $i -resize 100x100 small/$i;
  convert -size 800x800 $i -resize 100x100 big/$i;
  echo "done.";
done

It is sufficient for my purposes.

Todo for the plugin:
-requesting http://localhost/gallery/lena/ without index.html is not yet 
matched (I had a fix for this, but I cant remember what it was...)
-I tried to align the left- and right arrows vertically in the table (using 
valign="middle") but this didn't work. Maybe some of the html gurus can fix 
this.
-what is the required syntax for links and images <a> and <img> or <link> and 
<figure>, document-v20.dtd seems to allow both?
-I haven't tried other image types than jpg. Maybe there is still some hidden 
code which assumes this. Can someone test this?
-Implement the comment.xml feature (how can I merge the xml from the 
imagedirectory-generator and the comment.xml)
-Implement tool-tip infos
-Implement reading of exif data in cocoon imagedirectory-generator
-Implement a template facility for the picture page (so you can change the 
layout, right now everything is hardcoded in gallerypicture.xsl). This would 
require again merging of two xml sources...

But since I really don't have time for this, I leave these exercises to the 
reader (I really hate this sentence in textbooks, but it is fun to use it in  
his own texts ;-) )

Cheers,

Jörg

-- 
Dipl.-Phys. Jörg Werner   j.werner@physik.uni-stuttgart.de
Universität Stuttgart
5. Physikalisches Institut  Telefon: 0711/685-5195
Pfaffenwaldring 57   Telefax: 0711/685-3810
D-70550 Stuttgart
Visit our Homepage: 
http://www.physik.uni-stuttgart.de/institute/pi/5/index.html
My private Homepage: http://schreibubi.pi5.physik.uni-stuttgart.de/
GPG-Key fingerprint: FDD9 7AAF BD31 1F3C FD9D  7D34 C00A 22BB C0AF DFB2



Re: XSL for Photo Gallery

Posted by Thorsten Scherler <th...@apache.org>.
El lun, 22-11-2004 a las 14:18, Jörg Werner escribió:
> Hello Ross,
> 
> > > Do whatever you want with code, I thereby license it under the
> > > BSD-License.
> >
> > I missed this line on the first reading. The BSD license is compatible
> > with the Apache license so we can still use your code. However, if we
> > want to host it as a plugin here it will need to be ASF2 licensed.
> 
> Okay, so I hereby state that the code is dual licensed under BSD and ASF2.
> It would be really great to see the plugin hosted at apache.org. I really like
> the forrest project so I think it is time to give something back...
> 

Nice to hear. :)

> > Jorg - thanks for your donation, this is great (I have my first baby on 
> > the way in a week or two, I'll certainly finish the pluygin then if 
> > no-one else does).
> Good luck, I expect my second in January... But don't think that you'll have 
> time to spend on hacking. I can tell from my own experience...
> 

Congrats to you both! Still waiting for a success note for my first one.
;-)

I am still learning the plugin concept I reckon I will some time to add
it.

> Cheers, Jörg

to you ;-)
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: XSL for Photo Gallery

Posted by Ross Gardler <rg...@apache.org>.
Jörg Werner wrote:
>>>Do whatever you want with code, I thereby license it under the
>>>BSD-License.
>>
>>I missed this line on the first reading. The BSD license is compatible
>>with the Apache license so we can still use your code. However, if we
>>want to host it as a plugin here it will need to be ASF2 licensed.
> 
> 
> Okay, so I hereby state that the code is dual licensed under BSD and ASF2.
> It would be really great to see the plugin hosted at apache.org. I really like
> the forrest project so I think it is time to give something back...

Cool - thanks.

>>Jorg - thanks for your donation, this is great (I have my first baby on 
>>the way in a week or two, I'll certainly finish the pluygin then if 
>>no-one else does).
> 
> Good luck, I expect my second in January... But don't think that you'll have 
> time to spend on hacking. I can tell from my own experience...

Well this is my full time job these days so I should still find some 
time - it will be my sanity ;-)

Ross


Re: XSL for Photo Gallery

Posted by Jörg Werner <jo...@pi5.physik.uni-stuttgart.de>.
Hello Ross,

> > Do whatever you want with code, I thereby license it under the
> > BSD-License.
>
> I missed this line on the first reading. The BSD license is compatible
> with the Apache license so we can still use your code. However, if we
> want to host it as a plugin here it will need to be ASF2 licensed.

Okay, so I hereby state that the code is dual licensed under BSD and ASF2.
It would be really great to see the plugin hosted at apache.org. I really like
the forrest project so I think it is time to give something back...

> Jorg - thanks for your donation, this is great (I have my first baby on 
> the way in a week or two, I'll certainly finish the pluygin then if 
> no-one else does).
Good luck, I expect my second in January... But don't think that you'll have 
time to spend on hacking. I can tell from my own experience...

Cheers, Jörg


-- 
Dipl.-Phys. Jörg Werner   j.werner@physik.uni-stuttgart.de
Universität Stuttgart
5. Physikalisches Institut  Telefon: 0711/685-5195
Pfaffenwaldring 57   Telefax: 0711/685-3810
D-70550 Stuttgart
Visit our Homepage: 
http://www.physik.uni-stuttgart.de/institute/pi/5/index.html
My private Homepage: http://schreibubi.pi5.physik.uni-stuttgart.de/
GPG-Key fingerprint: FDD9 7AAF BD31 1F3C FD9D  7D34 C00A 22BB C0AF DFB2



Re: XSL for Photo Gallery

Posted by Ross Gardler <rg...@apache.org>.
joerg+computer.forrest@pi5.physik.uni-stuttgart.de wrote:
> I once did a picture gallery for forrest. You can find the result at 
> http://schreibubi.pi5.physik.uni-stuttgart.de/gallery/lena/newcam/index.html

<snip/>

> Do whatever you want with code, I thereby license it under the BSD-License.

I missed this line on the first reading. The BSD license is compatible 
with the Apache license so we can still use your code. However, if we 
want to host it as a plugin here it will need to be ASF2 licensed.

There is no problem with you keeping the BSD license, it just means the 
plugin will have to be hosted elsewhere. Can we use the Apache License, 
or would you prefer it under BSD?

Ross

Re: XSL for Photo Gallery

Posted by jo...@pi5.physik.uni-stuttgart.de.
Hi,

I once did a picture gallery for forrest. You can find the result at 
http://schreibubi.pi5.physik.uni-stuttgart.de/gallery/lena/newcam/index.html

When the plugin system came around I've started to adapt it to the plugin 
system, but never came around to finish it. It is almost working, but right 
now I don't have the time to finish it, because I have to write my 
PhD-Thesis. I've attached the last version to this e-mail.

It works like this:
-Uses the image directory generator from cocoon to get a list of images
(directory structure is a dir with the following dirs small, big, preview 
(where the pictures can be found in different sizes).
-gallery.xsl transforms this into valid forrest-html, which is rendered 
according to the selected skin
-To display one picture gallerybild.xsl is used. The version in the archive 
tries to use a template.xml as template, where only the picture name of the 
picture is substituted and then skinned. This dosn't work yet... So I've also 
included the old version where everything is hardcoded.

Some more ideas I had for the gallery, is to have a file comment.xml where you 
can put in comments about each picture, which are displayed under the full 
picture (maybe in the format which digikam from KDE writes...so you can edit 
your comments comfortably). Maybe also tooltips on each preview image with 
the size and other information added (would be great if the directory 
generator from cocoon could interpret exif...)

Do whatever you want with code, I thereby license it under the BSD-License.

Hope this helps,

Jörg

On Sunday 21 November 2004 09.15, Alex Batlin wrote:
> I was looking for a photo gallery plugin for forrest. I found JAlbum, seems
> a very nice GUI product, but I have not found an XSL that can be plugged
> in, anyone seen one?

-- 
Dipl.-Phys. Jörg Werner   j.werner@physik.uni-stuttgart.de
Universität Stuttgart
5. Physikalisches Institut  Telefon: 0711/685-5195
Pfaffenwaldring 57   Telefax: 0711/685-3810
D-70550 Stuttgart
Visit our Homepage: 
http://www.physik.uni-stuttgart.de/institute/pi/5/index.html
My private Homepage: http://schreibubi.pi5.physik.uni-stuttgart.de/
GPG-Key fingerprint: FDD9 7AAF BD31 1F3C FD9D  7D34 C00A 22BB C0AF DFB2