Monthly Archives: April 2008

image uploading in Grails with 5 lines of code

In your domain class, define


class Something{
byte[] image
}

in your controller, call

def image= {
def something = Something.get( params.id )
byte[] image = something.image
response.outputStream << image
}

Image gets copied to the database. You can then show it by

<img src="${createLink(controller:'something', action:'image', id: something.id)}"/>

Advertisements

Preparing MXML files to be Browser Manager aware

Recently, we have started using the Deep Linking features introduced in Adobe Flex. It has worked out fairly well for what we needed it for, but there was a fairly persistent issue with component initialization. This post will describe the issue and present a proper way of making components aware of the initial state.

Continue reading