Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18982] Android: Blob methods do not work

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2015-06-12T05:30:41.000+0000
Affected Version/sn/a
Fix Version/sRelease 4.1.0
ComponentsAndroid
Labelsandroid, regression
ReporterYissachar Radcliffe
AssigneeHieu Pham
Created2015-06-04T20:24:59.000+0000
Updated2015-06-16T23:06:54.000+0000

Description

When using certain Blob methods on Android I will get an error message like the following: _Message: Uncaught TypeError: Object # has no method 'imageAsCropped'_ I have tested the following methods, none of which worked on Android and all of which worked correctly on iOS. * imageAsCropped * imageAsResized * imageAsThumbnail * imageWithAlpha * imageWithRoundedCorner * imageWithTransparentBorder Test code:
var win = Titanium.UI.createWindow({
    backgroundColor:'#fff',
    layout: 'vertical'
});
win.open();

var greenBox = Titanium.UI.createView({
  backgroundColor: '#0f0',
  top: 50,
  left: 50,
  height: 50,
  width: 50
});
win.add(greenBox);

var blob = greenBox.toImage();
var boxAsImage = Titanium.UI.createImageView({
  image: blob,
  top: 50,
  left: 50,
  height: 50,
  width: 50
})
win.add(boxAsImage);

var cropped = blob.imageAsCropped({
  height: 10,
  width: 10,
  x: 10,
  y: 10
});

var thumbImage = Titanium.UI.createImageView({
  image: cropped,
  top: 50,
  left: 50
})
win.add(thumbImage);
On iOS this will display two 50px green squares with a third 10px green square underneath, while on Android, only the first two squares will be displayed (see screenshots).

Attachments

FileDateSize
Screen Shot 2015-06-04 at 4.04.15 PM.png2015-06-04T20:05:57.000+000034425
Screen Shot 2015-06-04 at 4.05.10 PM.png2015-06-04T20:07:47.000+000088689

Comments

  1. Hieu Pham 2015-06-11

    master PR: https://github.com/appcelerator/titanium_mobile/pull/6907 testing code:
       var win = Titanium.UI.createWindow({
           backgroundColor:'#fff',
           layout: 'vertical'
       });
       win.open();
        
       var greenBox = Titanium.UI.createView({
         backgroundColor: '#0f0',
         top: 50,
         left: 50,
         height: 50,
         width: 50
       });
       win.add(greenBox);
        
       var blob = greenBox.toImage();
       var boxAsImage = Titanium.UI.createImageView({
         image: blob,
         top: 50,
         left: 50,
         height: 50,
         width: 50
       })
       win.add(boxAsImage);
        
       var cropped = blob.imageAsCropped({
         height: 10,
         width: 10,
         x: 10,
         y: 10
       });
       
       var logoimage = Titanium.UI.createImageView({
           image:cropped
       });
       win.add(logoimage);
       
  2. Lokesh Choudhary 2015-06-16

    Verified the fix. Blob methods work as expected. Environment: Appc Studio : 4.1.0.201505071004 Ti SDK : 4.1.0.v20150614181235 Ti CLI : 4.0.1 Alloy : 1.6.2 MAC Yosemite : 10.10.3 Appc npm : 4.0.1 Appc CLI : 4.0.2 Node: v0.10.37 Android 5.0.2

JSON Source