appcelerator - Image getting stretched when used round shape ImageView -
i want display image in round shape , able display user image in round shape, not able manage image quality.image getting shrinked/stretched.i trying test in android device.
titanium studio information
titanium studio, build: 3.4.1.201410281727 build: jenkins-titanium-rcp-master-202
device screenshot of stretched image. http://i60.tinypic.com/23hq9lv.png
my code follows.
view
<view id="userpiceview"> <imageview id="userimage" onclick="chooespic"></imageview> </view>
tss
"#userpiceview":{ left : "10%", width: 84, height: 84, borderradius: 42, bordercolor: '#f05323', borderwidth: 3, } "#userimage":{ autorotate: true, image: "/images/defaultuser.png", defaultimage: "/images/defaultuser.png", }
controller
function chooespic() { titanium.media.openphotogallery( { mediatypes : [ti.media.media_type_photo], success : function(event) { var imageg = event.media; ti.api.info("before" + imageg.height + " x " + imageg.width); ti.api.info("before" + imageg.length); try{ var imgblob = imageg.imageasresized(300,300); imageg=null; ti.api.info("after imgblob " + imgblob.height + " x " + imgblob.width); $.userimage.image=imgblob; imgblob=null; }catch(e){ ti.api.info("image conversion error"+e ); } if (event.mediatype == ti.media.media_type_photo) { var filename = titanium.filesystem.applicationdatadirectory + "/" + 'camera_photo' + new date().gettime() + ".png"; var f = titanium.filesystem.getfile(filename); if (f.exists()) { f = titanium.filesystem.getfile(filename); } f.write(imageg); pathfromgallery = f.nativepath; } } });}
Comments
Post a Comment