Reputation: 127
in practice after taking a picture using the function
Titanium.Media.showCamera({
success : function(event) {
var image = event.media;
var winTest = Alloy.createController('inputContentPost', {
'img' : image
}).getView();
winTest.open();
},
I call another controller to which the step imagines me back from the function and try to work it as shown in the following code:
var ImageFactory = require('ti.imagefactory');
var args = $.args;
var img = args.img;
var f = Ti.Filesystem.getFile(img);
var blob = f.read();
//imageViewTransformed.image = blob;
var newBlob = ImageFactory.imageAsResized(blob, {
width : 1024,
height : 1024,
quality : ImageFactory.QUALITY_HIGH
});
the problem is that returns me the error sequent
[ERROR] : Script Error {
[ERROR] : column = 2779;
[ERROR] : line = 1;
[ERROR] : message = "-[TiBlob hasPrefix:]: unrecognized selector sent to instance 0x1292da580";
all this only on iOS , while Android- there are no mistakes and everything works. You have any solution for me ??? Thank you
Upvotes: 0
Views: 226
Reputation: 995
In your "other file" args.img is the blob data already (it references event.media). There's no need to read from the file system. Try this:
var newBlob = ImageFactory.imageAsResized(args.img, {
width : 1024,
height : 1024,
quality : ImageFactory.QUALITY_HIGH
});
BTW, I'd also suggest you avoid creating variables you don't need. For example:
Titanium.Media.showCamera({
success : function(event) {
Alloy.createController('inputContentPost', {
img : event.media
}).getView().open();
},
Upvotes: 1