got a weird problem I am hoping someone can answer. I got a simple domain class
and controller to load/renderCode:class Photo { byte[] file String contentType static belongsTo = Listing static mapWith = "mongo" static constraints = { file(nullable:true, maxSize:1000000) contentType(nullable:false) } }
and in the GSPCode:class PhotoController { def photoService def propertyPhoto() { def photo = Photo.get(params.id) byte[] file = photo?.file response.setContentType(photo?.contentType) response.setContentLength(file?.length) response.outputStream << scaled }
When the page renders I am getting an error:Code:<div id="slider"> <ul> <g:each in="${listing?.photos }" var="photo" > <li><img src="${createLink(controller:'photo', action:'propertyPhoto', id:photo.id)}" alt="Property Photo" /></li> </g:each> </ul> </div>
Funny thing is it works locally but is giving me this error when I deploy it (cloudfoundry) but I am also getting the same error locally on IE (works on Chrome). If I access the photo directly by hitting the photo controller /photo/propertyPhoto/[id] the content type is correct image/jpeg and it correctly renders itself in the browser.Code:Resource interpreted as image but transferred with MIME type text/html.
Any help is greatly appreciated.


Reply With Quote
