【发布时间】:2012-01-15 15:37:07
【问题描述】:
我正在使用图像库之类的应用程序。 这允许用户从他的计算机中选择文件并上传图像。上传图片后,该图片将显示在图库中。 我将图像保存在 blobstore 中,并通过 blobkey 获取。 我想得到一个缩略图(从原始图像调整大小) 在服务器端,我尝试使用图像 api 根据它的 blobkey 调整原始图像的大小,就像这样
public String getImageThumbnail(String imageKey) {
BlobKey blobKey = new BlobKey(imageKey);
Image oldImage = ImagesServiceFactory.makeImageFromBlob(blobKey);
/*
* can not get width anf height of "oldImage"
* then I try to get imageDate of old Image to create a new image like this
*/
byte[] oldImageData = oldImage.getImageData();
Image newImage1 = ImagesServiceFactory.makeImage(oldImageData);
/*
* however
* oldImage.getImageData(); return null/""
* and cause the Exception when call this ImagesServiceFactory.makeImage(oldImageData)
*/
}
是否有人在服务器端使用过图像 api,请告诉我如何获取从 blobkey 或字节创建的图像的宽度和高度[]
【问题讨论】:
-
这是什么语言?
标签: image api google-app-engine height width