[英]How to store Base64 image sent from client in BlobStore
我是BlobStore的新手,我從客戶端收到一個Base64圖像我正在轉換它像這樣:
byte [] picByte = Base64.decodeBase64(pic);
Blob blob = new Blob(picByte);
我正在使用球衣2,我的目標是保存這張圖片,然后獲得服務鏈接blobstoreService.serve
如何用球衣2保存這個圖像? 謝謝,
byte[] picByte = Base64.decodeBase64(pic);
GcsFileOptions instance = new GcsFileOptions.Builder().mimeType("image/jpeg").build();
GcsFilename fileName = new GcsFilename("xxx-app.appspot.com", "someName.jpg");
GcsOutputChannel outputChannel;
GcsService gcsService = GcsServiceFactory.createGcsService();
outputChannel = gcsService.createOrReplace(fileName, instance);
ByteBuffer a = ByteBuffer.wrap(picByte);
outputChannel.write(a);
outputChannel.close();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.