在钛Appcelerator的,当我拍摄图像,并在的ImageView
,图像显示不被显示,相反,下面正在显示警告。
In Titanium appcelerator, when I capture an image and show in an ImageView
, image is not being shown, instead, below warning is being shown.
[WARN]:OpenGLRenderer:位图太大而不能上传到一个纹理(1840x3264,上限= 2048×2048)
[WARN] : OpenGLRenderer: Bitmap too large to be uploaded into a texture (1840x3264, max=2048x2048)
如何解决这个问题呢?而在平板电脑它工作正常,但在高分辨率的设备不工作。
How to solve this problem? Whereas in tablet it is working fine, but in high resolution device its not working.
当我将图像插入,则会出现此一个的ImageView
从相机拍摄或选择从画廊的时候。
This one occurs when I insert an image into a ImageView
when shot from camera or pick from the gallery.
这是因为不同的手机有不同数量的可用纹理内存的依赖于硬件,而他们的OpenGL版本,这个特定的值 GL_MAX_TEXTURE_SIZE
键,可以为每个电话抬头的这里,并在其他地方。
This is because different phones have different amounts of texture memory available depending on hardware, and their OpenGL version, this specific value is GL_MAX_TEXTURE_SIZE
and can be looked up per phone here and in other places.
要解决此问题,将图像转换为一个blob,然后用内置函数调整它的大小:的 imageAsResized ,在拍照后的成功回调。
To work around this, convert the image to a blob and then resize it using a built-in function: imageAsResized, in the success callback after taking a picture.
Ti.Media.showCamera({
....
success : function(e) {
// Resized to a size that most phones should support
var resizedImage = e.media.imageAsResized(1024, 1024);
// Set the image view with the resized image
imageView.image = resizedImage;
},
....
});