Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4596] iPad: Resized image of ImageView

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionNeeds more info
Resolution Date2011-08-02T15:22:10.000+0000
Affected Version/sRelease 1.7.1
Fix Version/sSprint 2011-32
ComponentsiOS
Labelsn/a
ReporterMiguel Vizcaino
AssigneeBlain Hamon
Created2011-07-05T16:43:38.000+0000
Updated2017-03-03T22:30:20.000+0000

Description

* We want to *re-size* an image to map components to certain coordinates in the _ImageView_. * Get the *+height+* and *+width+* properties of the _resized_ image.

var win = Ti.UI.createWindow({
	backgroundColor:'blue'
});

var image = Titanium.UI.createImageView({
	image:'http://lh5.ggpht.com/-J7Q7cUDEFOU/S_bKEoyMSzI/AAAAAAAAGIw/PZJduitsVa0/largeNewGoogleLogoFinalFlat-a.png',
	height: 'auto'
});
image.addEventListener('load', function(){
	var img = image.toImage();
	alert("Width: "+ img.width + " / Height: " + img.height);
});

Titanium.Gesture.addEventListener('orientationchange', function(e) {
	alert("Orientation: " + e.orientation);
	
	var img2 = image.toImage();
	alert("Width: "+ img2.width + " / Height: " + img2.height);
});

win.add(image);
win.open();
- *toBlob() :* gives us the _source_ image's dimensions. - *toImage() :* gives us the _width_ and _height_ of the image display it. {quote}

Associated Helpdesk Ticket

http://support.appcelerator.com/tickets/APP-238573 {quote}

Comments

  1. Blain Hamon 2011-08-02

    I'm not exactly following. This sounds more like we need better documentation on blob handling to stop the imageView abuse antipattern.
  2. Lee Morris 2017-03-03

    Closing as duplicate.

JSON Source