in app/controllers/ImageBinaryController.scala [18:36]
def image(id: Long) = Action.async { request =>
ImageRepository.image(id).map {
case Some(image) => {
image.bin match {
case Some(bin) => {
/** bin: Array[Byte] */
Result(
header = ResponseHeader(200),
body = HttpEntity.Strict(ByteString.fromArray(bin), Some("image/png"))
).withHeaders(
"Cache-Control" -> "max-age=3600"
)
}
case None => NotFound("Not Found")
}
}
case None => NotFound("Not Found")
}
}