The appengine/image package works fine with images stored in Blobstore. However, what would be a good approach to resize images stored in Google Cloud Storage?
1条回答 默认 最新
douhui2307 2014-04-30 00:46关注You can use the same Image Service with the Google Cloud Storage, especially if you use Blobstore API for uploading images.
A sample code in Java:
String fullName = "/gs/" + bucketName + "/" + objectName; Image picture = ImagesServiceFactory.makeImageFromFilename(fullName); Transform resize = ImagesServiceFactory.makeResize(maxWidth, maxHeight); picture = imagesService.applyTransform(resize, picture);In Go, you can use BlobKeyForFile function:
BlobKeyForFile returns a BlobKey for a Google Storage file. The filename should be of the form "/gs/bucket_name/object_name".
解决 无用评论 打赏 举报