Re: Photo Album

Christian Egli <[email protected]>
Newsgroups gmane.comp.cms.wyona.user
Message-ID <[email protected]>
Alex McLintock <[email protected]> writes:

> At 22:22 02/09/02, you wrote:
> >The new book "Cocoon: Building XML Applications" written by Matthew Langham
> >and Carsten Ziegeler might be interesting for you. While it does not deal
> >with Wyona the authors explain an image gallery example.
>
> Lets look at the examples for instance. I don't just want to learn how
> to do any old photo album. I want to learn the best way to do a photo
> album.

I cannot tell you what the best way to do a photo album is :-). 

> It is not dynamic... there are no thumbnails.... The book did show me
> how to do a page of thumbnails which I didn't know before.
> 
> I have low res images used for the web, and high res images used for
> the printable PDF. The main problem I have with the Langham/Ziegler
> photo album is that it doesn't seem to associate any extra information
> with the photo. All we have is the file name - which isn't really such
> a good idea. I want to learn about the proper way to associate extra
> XML based information with the photo such as where it was taken, who
> is in it, and so on.

The File upload which finally works for the unipublic site does this
and more.

The basic idea of how it works is as follows:

1. You have a link in your existing document which invokes the upload
   form and passes it the xpath of itself. 

2. Once you're in the upload form you enter the file name of the file
   that you want to upload along with some additional (dublin core)
   information such as description, keywords, title, creator, etc. 

3. The submit button of the form then does a post which is handled in
   a cocoon action.

   a) The action copies the file into an appropriate directory,

   b) creates a meta xml file that contains all the dublin core meta
      information for the uploaded file  

   c) and inserts a <media> element at the xpath where the originating
      link was in the requesting document.

4. After the action the sitemap does a redirect to the original
   document where the image is now inserted (with appropriate caption,
   alt tag, etc.).

This can all be found in CVS. Check the following files:

src/webapp/wyona/cms/pubs/unipublic/authoring-sitemap.xmap
src/java/org/wyona/cms/cocoon/acting/ArticleImageUploadCreatorAction.java
src/webapp/wyona/cms/docs/cms/upload-image.xsp
src/webapp/wyona/cms/stylesheets/cms/Page/upload-image.xsl

Michael is breathing down my neck to make sure I'm writing the
documentation. It's not in CVS yet but above should get you
started for now. 

You might want to subclass the ArticleImageUploadCreatorAction e.g. to
add a different media tag or to have the images stored in a different
path.

Mail me if you have questions and or suggestions.

-- 
Christian Egli
wyona: research & development
http://www.wyona.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.