Created
January 6, 2012 15:14
-
-
Save jdmr/1571005 to your computer and use it in GitHub Desktop.
Groovy Show Image Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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