Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Resizing an Image

Hi,

I'm trying to take an image, resize it and store it in an array, but my app keeps force-closing. Can anyone spot where I'm going wrong?

Cheers,
Mark



var image = []
var win = Ti.UI.createWindow({ backgroundColor: 'white' })
var imageView = Ti.UI.createImageView({
    top:20,
    width:100,
    height:100,
    backgroundColor: 'blue'
})
var button = Ti.UI.createButton({
    title:"Take",
    top:200
})

button.addEventListener('click', function () {
    Ti.Media.showCamera({
        success: function(e) {
            var temp = Ti.UI.createImageView ({
                backgroundImage: e.media,
                width:100,
                height:100
            })

            image[image.length]=temp.toImage();

            imageView.image=image[image.length-1]
        }
    })
})

win.add(imageView)
win.add(button)
win.open();
— asked August 25th 2010 by Mark Peace
  • scale
  • showcamera
0 Comments

1 Answer

  • Accepted Answer

    If you are testing this in Android it will not work. I believe they messed up the ImageView for Android and you can't re-size images. It will be fixed in Release 1.5.0 I believe.

    — answered August 25th 2010 by Colton Arabsky
    permalink
    1 Comment
    • Ah, it is android - so I guess this is the problem. Boo :(

      — commented August 25th 2010 by Mark Peace
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.