Reputation: 193
I have followed the tutorials for storing an image using the Play framework which works great but am now curious on how you can leverage the models to store an image that was not uploaded. In my case, when the user uploads a file, I do some processing and generate an image. I would then like to write this image to the DB. If the image field in the model is of data type Blob, what is the correct way to create the Blob from the image file generated?
Thanks.
Upvotes: 0
Views: 147
Reputation: 318
If Image.data is a Blob field:
InputStream is = ...
String typeOfAttachment = ...
image.data.set(is,typeOfAttachment)
Upvotes: 1