Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 钛2:获得图像大小?_Android_Iphone_Titanium - Fatal编程技术网

Android 钛2:获得图像大小?

Android 钛2:获得图像大小?,android,iphone,titanium,Android,Iphone,Titanium,我用钛。我用安卓NexusS进行测试 我有一个斑点,是画廊里的一张照片。我找不到一种方法来获得这张照片的宽度和高度 我已经看到了一些关于auto属性的提示,但是自从Tianium 2.0以来,这个提示似乎没有运行 初试 结果“0 x 0” 第二次尝试 结果“自动x自动” 所以,我的简单问题是: 如何获取从图库中获取的照片的大小?经过几次尝试(在撰写此问题的过程中),我发现: Ti.Media.openPhotoGallery({ success : function(e) {

我用钛。我用安卓NexusS进行测试

我有一个斑点,是画廊里的一张照片。我找不到一种方法来获得这张照片的宽度和高度

我已经看到了一些关于auto属性的提示,但是自从Tianium 2.0以来,这个提示似乎没有运行


初试 结果“0 x 0”


第二次尝试 结果“自动x自动”


所以,我的简单问题是:

如何获取从图库中获取的照片的大小?

经过几次尝试(在撰写此问题的过程中),我发现:

Ti.Media.openPhotoGallery({
    success : function(e) {
        var img = Ti.UI.createImageView({
                    image : e.media, 
                    width: 'auto', 
                    height: 'auto' });
        alert(img.toImage().width + " x " + img.toImage().height);
}});
技巧是使用img.toImage().width

Ti.Media.openPhotoGallery({
    success : function(e) {
        var img = Ti.UI.createImageView({
                    image : e.media, 
                    width: 'auto', 
                    height: 'auto' });
        alert(img.width + " x " + img.height);
}});
Ti.Media.openPhotoGallery({
    success : function(e) {
        var img = Ti.UI.createImageView({
                    image : e.media, 
                    width: 'auto', 
                    height: 'auto' });
        alert(img.toImage().width + " x " + img.toImage().height);
}});