duanmao7553 2014-04-29 16:39
浏览 191

调整Google Cloud Storage中的图片大小

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-29 16: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".

    评论
    编辑
    预览

    报告相同问题?

    手机看
    程序员都在用的中文IT技术交流社区

    程序员都在用的中文IT技术交流社区

    专业的中文 IT 技术社区,与千万技术人共成长

    专业的中文 IT 技术社区,与千万技术人共成长

    关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

    关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

    客服 返回
    顶部