web services - Send base64 string as image to the client -
i managed save image base64 encoded string in database, wondering how tu serve base64 string in way interpreted image on client side.
i made ws returns string :
return ok(mybase64string).as("image/jpeg")
but image cannot displayed in browser.
if decode string , send byte array image displayed, dont understand why have decode encoded image in order display in client??
byte [] test = base64.decodebase64(event.getphoto()); homecoming ok(test).as("image/jpeg");
this works why have decode base of operations 64 string??
anyone have idea? thanks!!
if want utilize base64, need utilize data uri scheme:
<img src="data:image/png;<base64>" />
otherwise have pass in path binary representation. that's assets controller does, serving file binary.
image web-services rest playframework playframework-2.0
No comments:
Post a Comment