ImageFactory.imageAsResized返回null [英] ImageFactory.imageAsResized returns null

查看:210
本文介绍了ImageFactory.imageAsResized返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用ImageFactory.imageAsResized调整大小的图像。

I tried to use ImageFactory.imageAsResized for resizing images.

但有些时候对某些图像返回null。

but some times for some images it returns null.

我想知道的是有我们想要上传图片的规格。???

I want to know is there any specification for images that we want to upload.???

给code可能会显示我的问题

given code may show my problem

var saveImageData = ImageFactory.imageAsResized(image, {
                        width : 480,
                        height : 360
                    });

        if (saveImageData !== null) {
        var toast = Titanium.UI.createNotification({
                    duration : 1000,
                    message : "save true "+saveImageData
                });
                toast.show();

    } else{
        var toast = Titanium.UI.createNotification({
                duration : 1000,
                message : "Problem in image resizing "+saveImageData
                        });
                toast.show();
};

在这上面code有时我得到null.whats是什么原因呢?

in this above code some times i got null.whats is the reason for that?

这是基于我们上传图片大小?

Is it based on image size that we uploading?

如果这是正确的..然后为同样大小的图像显示它有时无效,有时不为空。
什么是这个疑难问题斜面能够处理这个ImageFactory功能。

if it is correct.. then for same size image its shows some times null,some times not null. whats is this problem.i cant able to handle this ImageFactory functionality.

请给任何solution.because我stucked与我的应用程序这个问题。

please give any solution.because i stucked with this problem on my app.

谢谢大家。

推荐答案

首先,检查图像不为空。其次而是采用了ImageFactory使用内置的方法。即Titanium.Blob.imageAsResized

First, check if image is not null. Secondly instead of using the ImageFactory use the builtin method. i.e Titanium.Blob.imageAsResized

我认为形象变量的数据BLOD。所以你可以叫image.imageAsResized(480360);

I assume that "image" variable has the blod data. so you can just call image.imageAsResized(480,360);

希望这有助于

这篇关于ImageFactory.imageAsResized返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆