[Seaside] On Forms, PNGs, WAFiles, and ByteArrays

Robert Sirois watchlala at hotmail.com
Mon Jan 11 00:21:24 UTC 2010

I wrote a simple form to upload images to the server, and I would like to create thumbnails for them automatically.

The way I ended up doing it is as follows:

    | aForm newForm |
    " add original file under name blahblahPng or whatever the image type is "
    UGFileLibrary addFileNamed: title,'Png' contents: uploadedFile contents.

    aForm := (PNGReadWriter createAFormFrom: uploadedFile contents) first.
    " create thumbnail and save under name blahblahThumbPng "
    newForm := aForm scaledToSize: (Point x: 50 y: 50).

    " what I would have liked to do here is add the thumbnail to the file library "

    " add item to art section "
    UGArt addImage: (
            title: title path: title,'Png') artist: self session user; imageForm: aForm; thumbForm: newForm; yourself

As you can see, I ended up using WAImageTag #form: rather than a url from the file library (or server directory, preferably). So what I would like to know are two things:

1) Forms are big? So throwing them around is cumbersome?
2) Is there a way to convert a Form back to a PNG without the whole mime thing?

Hotmail: Free, trusted and rich email service.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20100110/ad8158dd/attachment.htm

More information about the seaside mailing list