appengine/image 包可以很好地处理存储在 Blobstore 中的图像。但是,调整存储在 Google Cloud Storage 中的图像大小的好方法是什么?
您可以将相同的图像服务与 Google Cloud Storage 一起使用,特别是当您使用 Blobstore API 上传图像时。
Java 中的示例代码:
String fullName = "/gs/" + bucketName + "/" + objectName;
Image picture = ImagesServiceFactory.makeImageFromFilename(fullName);
Transform resize = ImagesServiceFactory.makeResize(maxWidth, maxHeight);
picture = imagesService.applyTransform(resize, picture);
在 Go 中,您可以使用文件的 BlobKey功能:
BlobKeyForFile 返回 Google 存储文件的 BlobKey。这
文件名的格式应为“/gs/bucket_name/object_name”。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)