@(image: Option[models.market.Image])(implicit flash: play.api.mvc.Flash)
@main {
@image.get.id
@image.get.data.length
<img height="100" width="200" src="@routes.Market.getImageById(image.get.id.get)" />
}
<img height="100" width="200" src="@{Market.getImageById(image.get.id.get)}" />
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/mJzolE1xDG0J.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/dglO2shttIAJ.
So this is the correct and preferred way to render images from a database?
Sent from my iPhone
The other one you got is actually completely equivalent to the first one, except for that it uses the old Groovy-based templates.
On Sunday, March 25, 2012 7:03:11 AM UTC+2, Dombou wrote:Hi guys,--I have a model to my view that contains a java.sql.Blob object. I want to render this Blob object as an image.The code for the view looks like this:@(image: Option[models.market.Image])(implicit flash: play.api.mvc.Flash)
@main {
@image.get.id
@image.get.data.length
<img height="100" width="200" src="@routes.Market.getImageById(image.get.id.get)" />
}That code works, but notice how I have actually had to provide a separate controller - and thus a separate router - for the handling of an image. Is it possible to just call a function that returns a binary stream or something?I've searched through this group, StackOverflow etc and I see a lot of people doing this:<img height="100" width="200" src="@{Market.getImageById(image.get.id.get)}" />But it doesn't work for me.
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/dglO2shttIAJ.
To post to this group, send email to play-framework@googlegroups.com.
To unsubscribe from this group, send email to play-framework+unsubscribe@googlegroups.com.