Skip to content

Instantly share code, notes, and snippets.

@jdmr
Created January 6, 2012 15:14
Show Gist options
  • Save jdmr/1571005 to your computer and use it in GitHub Desktop.
Save jdmr/1571005 to your computer and use it in GitHub Desktop.
Groovy Show Image Controller
def imagen = {
def imagen = Imagen.get(params.id)
log.debug "Mostrando imagen ${imagen?.nombre}"
response.setHeader("Content-disposition", "attachment; filename=${imagen?.nombre}")
response.contentType = imagen?.tipoContenido
byte[] archivo = imagen?.archivo
response.contentLength = imagen?.tamano
response.outputStream << imagen.archivo
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment