[ 
https://issues.apache.org/jira/browse/CB-7845?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14955984#comment-14955984
 ] 

Richard B Knoll commented on CB-7845:
-------------------------------------

targetWidth and targetHeight are used for specifying a maximum bounding box for 
the image rather than an actual size (the image should not be scaled up and 
aspect ratio is maintained). For example, specifying  {{targetWidth:1000}} and 
{{targetHeight:1000}} and inserting a 200x200 image would result in a 200x200 
image in your app. Conversely, specifying {{targetWidth:100}} and 
{{targetHeight:200}} for that same image will make the image in your app be 
100x100 (as it is constrained by the lower dimension). The reason your image is 
appearing so small is probably because the cropping Activity is outputting a 
small image (which the plugin won't scale up).

The Android implementation of the camera plugin uses the 
{{com.android.camera.action.CROP}} intent to find an application that is 
already installed on the device and that can handle image cropping to do the 
image editing. Unfortunately, this is [not an officially supported API in the 
Android 
SDK|https://groups.google.com/forum/#!topic/android-developers/LdZHUjkmGSw] and 
works only because most devices come with an application that handles that 
particular Intent (Google Plus Photos). The camera plugin documentation 
mentions that Google Plus is the only cropping utility that works consistently, 
which explains why using the Gallery app fails. The plugin documentation should 
probably have a clearly stated warning that using {{allowEdit}} on Android is 
unpredictable (we are completely at the mercy of whatever application picks up 
the Intent/what applications the user has installed) and may break in the 
future if Google Plus Photos decides to remove its support. Unfortunately, the 
only solution might be to implement our own cropping utility.

> Camera Photos on Android 4.4.4 (Moto X) being scaled down when allowEdit=true
> -----------------------------------------------------------------------------
>
>                 Key: CB-7845
>                 URL: https://issues.apache.org/jira/browse/CB-7845
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Camera
>         Environment: Android 4.4.4 (Moto X)
>            Reporter: Rajat Paharia
>
> Using the following settings:
> Quality: 85, allowEdit=true, targetWidth=1000, targetHeight=1000, 
> correctOrientation: true, destinationType: FILE_URI, encodingType: JPEG, 
> sourceType: CAMERA, saveToPhotoAlbum: false
> The picture is taken, accepted, then the crop screen is shown with a fixed 
> square crop. I select Done and then upload the image to my server. The image 
> is always 281x281 pixels, instead of the desired 1000x1000. 
> Changing sourceType to PHOTOLIBRARY, and doing the same set of steps (except 
> picking an existing image from the gallery instead of taking a new one), on 
> the other hand, results in what was expected - a 1000x1000 square image. 
> Changing the quality to 100 has no effect on the dimensions. 
> Changing correctOrientation, saveToPhotoAlbum have no effect on dimensions. 
> Changing targetWidth and targetHeight to 2000 has no effect on dimensions.
> Removing the targetWidth and targetHeight results in images that are 304x303 
> pixels. 
> After accepting the picture and before the Crop screen comes up, I can 
> sometimes see the Google+ icon in the upper right and the title "Crop". I 
> have the Google+ app installed on my phone. 
> Using: 
> cordova 4.0.0
> Installed platforms: android 3.6.4, ios 3.6.3
> org.apache.cordova.camera 0.3.3 "Camera"
> (had the same problems with 3.5.0 and older version of Camera plugin). 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to