You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Shazron Abdullah (Created) (JIRA)" <ji...@apache.org> on 2011/11/28 23:31:41 UTC
[jira] [Created] (CB-54) Feature request: ability to downsize
pictures with camera.getPicture (no crop)
Feature request: ability to downsize pictures with camera.getPicture (no crop)
------------------------------------------------------------------------------
Key: CB-54
URL: https://issues.apache.org/jira/browse/CB-54
Project: Apache Callback
Issue Type: New Feature
Components: iOS
Reporter: Shazron Abdullah
reported at: https://github.com/phonegap/phonegap-iphone/issues/287
by: https://github.com/patdenice
Hi,
We're working on a mobile application using phonegap. The application is designed to upload photos from the smartphone/tablet to a Piwigo gallery. Piwigo is a popular open source web application to create photo galleries. The application "Piwigo for iOS/Android" is nearly complete, we just need the ability to downsize photos before upload. Unfortunately, targetWidth and targetHeight parameters on camera.getPicture method are designed to crop the photo, which is what we're seeking. Would it be possible to add maxWidth/maxHeight parameters and resize algorithm ?
Thanks.
P@t
Piwigo Team.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-54) Feature request: ability to downsize
pictures with camera.getPicture (no crop)
Posted by "Shazron Abdullah (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-54?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13251382#comment-13251382 ]
Shazron Abdullah commented on CB-54:
------------------------------------
see https://github.com/apache/incubator-cordova-ios/pull/12
> Feature request: ability to downsize pictures with camera.getPicture (no crop)
> ------------------------------------------------------------------------------
>
> Key: CB-54
> URL: https://issues.apache.org/jira/browse/CB-54
> Project: Apache Callback
> Issue Type: Bug
> Components: iOS
> Reporter: Shazron Abdullah
> Fix For: 1.7.0
>
>
> reported at: https://github.com/phonegap/phonegap-iphone/issues/287
> by: https://github.com/patdenice
> Hi,
> We're working on a mobile application using phonegap. The application is designed to upload photos from the smartphone/tablet to a Piwigo gallery. Piwigo is a popular open source web application to create photo galleries. The application "Piwigo for iOS/Android" is nearly complete, we just need the ability to downsize photos before upload. Unfortunately, targetWidth and targetHeight parameters on camera.getPicture method are designed to crop the photo, which is what we're seeking. Would it be possible to add maxWidth/maxHeight parameters and resize algorithm ?
> Thanks.
> P@t
> Piwigo Team.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CB-54) Feature request: ability to downsize
pictures with camera.getPicture (no crop)
Posted by "Shazron Abdullah (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-54?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Shazron Abdullah updated CB-54:
-------------------------------
Priority: Major (was: Minor)
Fix Version/s: 1.6.0
Issue Type: Bug (was: New Feature)
> Feature request: ability to downsize pictures with camera.getPicture (no crop)
> ------------------------------------------------------------------------------
>
> Key: CB-54
> URL: https://issues.apache.org/jira/browse/CB-54
> Project: Apache Callback
> Issue Type: Bug
> Components: iOS
> Reporter: Shazron Abdullah
> Fix For: 1.6.0
>
>
> reported at: https://github.com/phonegap/phonegap-iphone/issues/287
> by: https://github.com/patdenice
> Hi,
> We're working on a mobile application using phonegap. The application is designed to upload photos from the smartphone/tablet to a Piwigo gallery. Piwigo is a popular open source web application to create photo galleries. The application "Piwigo for iOS/Android" is nearly complete, we just need the ability to downsize photos before upload. Unfortunately, targetWidth and targetHeight parameters on camera.getPicture method are designed to crop the photo, which is what we're seeking. Would it be possible to add maxWidth/maxHeight parameters and resize algorithm ?
> Thanks.
> P@t
> Piwigo Team.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CB-54) Feature request: ability to downsize
pictures with camera.getPicture (no crop)
Posted by "Shazron Abdullah (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-54?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Shazron Abdullah updated CB-54:
-------------------------------
Fix Version/s: (was: 1.7.0)
1.6.1
> Feature request: ability to downsize pictures with camera.getPicture (no crop)
> ------------------------------------------------------------------------------
>
> Key: CB-54
> URL: https://issues.apache.org/jira/browse/CB-54
> Project: Apache Callback
> Issue Type: Bug
> Components: iOS
> Reporter: Shazron Abdullah
> Assignee: Shazron Abdullah
> Fix For: 1.6.1
>
>
> reported at: https://github.com/phonegap/phonegap-iphone/issues/287
> by: https://github.com/patdenice
> Hi,
> We're working on a mobile application using phonegap. The application is designed to upload photos from the smartphone/tablet to a Piwigo gallery. Piwigo is a popular open source web application to create photo galleries. The application "Piwigo for iOS/Android" is nearly complete, we just need the ability to downsize photos before upload. Unfortunately, targetWidth and targetHeight parameters on camera.getPicture method are designed to crop the photo, which is what we're seeking. Would it be possible to add maxWidth/maxHeight parameters and resize algorithm ?
> Thanks.
> P@t
> Piwigo Team.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CB-54) Feature request: ability to downsize
pictures with camera.getPicture (no crop)
Posted by "Brian LeRoux (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-54?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brian LeRoux updated CB-54:
---------------------------
Fix Version/s: (was: 1.6.0)
1.7.0
> Feature request: ability to downsize pictures with camera.getPicture (no crop)
> ------------------------------------------------------------------------------
>
> Key: CB-54
> URL: https://issues.apache.org/jira/browse/CB-54
> Project: Apache Callback
> Issue Type: Bug
> Components: iOS
> Reporter: Shazron Abdullah
> Fix For: 1.7.0
>
>
> reported at: https://github.com/phonegap/phonegap-iphone/issues/287
> by: https://github.com/patdenice
> Hi,
> We're working on a mobile application using phonegap. The application is designed to upload photos from the smartphone/tablet to a Piwigo gallery. Piwigo is a popular open source web application to create photo galleries. The application "Piwigo for iOS/Android" is nearly complete, we just need the ability to downsize photos before upload. Unfortunately, targetWidth and targetHeight parameters on camera.getPicture method are designed to crop the photo, which is what we're seeking. Would it be possible to add maxWidth/maxHeight parameters and resize algorithm ?
> Thanks.
> P@t
> Piwigo Team.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (CB-54) Feature request: ability to downsize
pictures with camera.getPicture (no crop)
Posted by "Shazron Abdullah (Resolved) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-54?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Shazron Abdullah resolved CB-54.
--------------------------------
Resolution: Duplicate
Assignee: Shazron Abdullah
Fixed in CB-183
> Feature request: ability to downsize pictures with camera.getPicture (no crop)
> ------------------------------------------------------------------------------
>
> Key: CB-54
> URL: https://issues.apache.org/jira/browse/CB-54
> Project: Apache Callback
> Issue Type: Bug
> Components: iOS
> Reporter: Shazron Abdullah
> Assignee: Shazron Abdullah
> Fix For: 1.7.0
>
>
> reported at: https://github.com/phonegap/phonegap-iphone/issues/287
> by: https://github.com/patdenice
> Hi,
> We're working on a mobile application using phonegap. The application is designed to upload photos from the smartphone/tablet to a Piwigo gallery. Piwigo is a popular open source web application to create photo galleries. The application "Piwigo for iOS/Android" is nearly complete, we just need the ability to downsize photos before upload. Unfortunately, targetWidth and targetHeight parameters on camera.getPicture method are designed to crop the photo, which is what we're seeking. Would it be possible to add maxWidth/maxHeight parameters and resize algorithm ?
> Thanks.
> P@t
> Piwigo Team.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-54) Feature request: ability to downsize
pictures with camera.getPicture (no crop)
Posted by "Shazron Abdullah (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-54?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13257889#comment-13257889 ]
Shazron Abdullah commented on CB-54:
------------------------------------
An update: I had to remove the JavaScript option cropToSize - the team doesn't want to add more iOS specific functions. What I did however was to make cropToSize = NO the default in the Objective-C code, which is the default in the other platform implementations.
> Feature request: ability to downsize pictures with camera.getPicture (no crop)
> ------------------------------------------------------------------------------
>
> Key: CB-54
> URL: https://issues.apache.org/jira/browse/CB-54
> Project: Apache Callback
> Issue Type: Bug
> Components: iOS
> Reporter: Shazron Abdullah
> Assignee: Shazron Abdullah
> Fix For: 1.7.0
>
>
> reported at: https://github.com/phonegap/phonegap-iphone/issues/287
> by: https://github.com/patdenice
> Hi,
> We're working on a mobile application using phonegap. The application is designed to upload photos from the smartphone/tablet to a Piwigo gallery. Piwigo is a popular open source web application to create photo galleries. The application "Piwigo for iOS/Android" is nearly complete, we just need the ability to downsize photos before upload. Unfortunately, targetWidth and targetHeight parameters on camera.getPicture method are designed to crop the photo, which is what we're seeking. Would it be possible to add maxWidth/maxHeight parameters and resize algorithm ?
> Thanks.
> P@t
> Piwigo Team.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CB-54) Feature request: ability to downsize
pictures with camera.getPicture (no crop)
Posted by "Shazron Abdullah (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-54?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Shazron Abdullah updated CB-54:
-------------------------------
Priority: Minor (was: Major)
> Feature request: ability to downsize pictures with camera.getPicture (no crop)
> ------------------------------------------------------------------------------
>
> Key: CB-54
> URL: https://issues.apache.org/jira/browse/CB-54
> Project: Apache Callback
> Issue Type: New Feature
> Components: iOS
> Reporter: Shazron Abdullah
> Priority: Minor
>
> reported at: https://github.com/phonegap/phonegap-iphone/issues/287
> by: https://github.com/patdenice
> Hi,
> We're working on a mobile application using phonegap. The application is designed to upload photos from the smartphone/tablet to a Piwigo gallery. Piwigo is a popular open source web application to create photo galleries. The application "Piwigo for iOS/Android" is nearly complete, we just need the ability to downsize photos before upload. Unfortunately, targetWidth and targetHeight parameters on camera.getPicture method are designed to crop the photo, which is what we're seeking. Would it be possible to add maxWidth/maxHeight parameters and resize algorithm ?
> Thanks.
> P@t
> Piwigo Team.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-54) Feature request: ability to downsize
pictures with camera.getPicture (no crop)
Posted by "Shazron Abdullah (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-54?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13158870#comment-13158870 ]
Shazron Abdullah commented on CB-54:
------------------------------------
by: https://github.com/jmunkki
I think it would be better to add new parameters to the settings map from JavaScript as suggested by patdenice. We have the same issue with the current version of PhoneGap. We are primarily interested in the Android version.
by: https://github.com/jmunkki
I read through the iOS and Android source code for the camera module. On Android, you can specify just one of the target size parameters and if you are getting the data in base64 encoded format, you will get a scaled down image with no cropping. In other words, if your camera module is 1024x768 (4:3) and you specify a targetWidth or 240, you will get a 240x180 result in landscape and a 240x320 result in portrait orientation. It's probably not exactly what you were hoping for, but it may be good enough (it's probably good enough for us).
On iOS, if either the target width or height is missing, the other one is also ignored, so this will not work.
> Feature request: ability to downsize pictures with camera.getPicture (no crop)
> ------------------------------------------------------------------------------
>
> Key: CB-54
> URL: https://issues.apache.org/jira/browse/CB-54
> Project: Apache Callback
> Issue Type: New Feature
> Components: iOS
> Reporter: Shazron Abdullah
>
> reported at: https://github.com/phonegap/phonegap-iphone/issues/287
> by: https://github.com/patdenice
> Hi,
> We're working on a mobile application using phonegap. The application is designed to upload photos from the smartphone/tablet to a Piwigo gallery. Piwigo is a popular open source web application to create photo galleries. The application "Piwigo for iOS/Android" is nearly complete, we just need the ability to downsize photos before upload. Unfortunately, targetWidth and targetHeight parameters on camera.getPicture method are designed to crop the photo, which is what we're seeking. Would it be possible to add maxWidth/maxHeight parameters and resize algorithm ?
> Thanks.
> P@t
> Piwigo Team.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-54) Feature request: ability to downsize
pictures with camera.getPicture (no crop)
Posted by "Shazron Abdullah (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-54?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13158869#comment-13158869 ]
Shazron Abdullah commented on CB-54:
------------------------------------
by: https://github.com/patdenice
I finally wrote a phonegap plugin to extend camera API:
In my app, I call camera.getResizedPicture method instead of camera.getPicture with same parameters. With targetWidth and targetHeight parameters, my image is just resized and not cropped.
cameraExtended.js
Camera.prototype.getResizedPicture = function(successCallback, errorCallback, options) {
// successCallback required
if (typeof successCallback != "function") {
console.log("Camera Error: successCallback is not a function");
return;
}
// errorCallback optional
if (errorCallback && (typeof errorCallback != "function")) {
console.log("Camera Error: errorCallback is not a function");
return;
}
PhoneGap.exec(successCallback, errorCallback, "com.phonegap.cameraExtended","getPicture",[options]);
};
cameraExtended.h
#import "PhoneGap/Camera.h"
@interface PGCameraExtended : PGCamera<UIImagePickerControllerDelegate,
UINavigationControllerDelegate,
UIPopoverControllerDelegate>
{
}
- (UIImage*)imageByScalingAndCroppingForSize:(UIImage*)anImage toSize:(CGSize)targetSize;
@end
cameraExtended.m
#import "cameraExtended.h"
@implementation PGCameraExtended
- (UIImage*)imageByScalingAndCroppingForSize:(UIImage*)anImage toSize:(CGSize)targetSize
{
UIImage *sourceImage = anImage;
UIImage *newImage = nil;
CGSize imageSize = sourceImage.size;
CGFloat width = imageSize.width;
CGFloat height = imageSize.height;
CGFloat targetWidth = targetSize.width;
CGFloat targetHeight = targetSize.height;
CGFloat scaledWidth = targetWidth;
CGFloat scaledHeight = targetHeight;
CGFloat ratio_width = width / targetWidth;
CGFloat ratio_height = height / targetHeight;
// maximal size exceeded ?
if (ratio_width > 1 || ratio_height > 1)
{
if (ratio_width < ratio_height)
{
scaledWidth = ceil(width / ratio_height);
}
else
{
scaledHeight = ceil(height / ratio_width);
}
targetSize = CGSizeMake(scaledWidth, scaledHeight);
self.pickerController.targetSize = targetSize;
}
else
{
return sourceImage;
}
UIGraphicsBeginImageContext(targetSize);
CGRect thumbnailRect = CGRectZero;
thumbnailRect.size.width = scaledWidth;
thumbnailRect.size.height = scaledHeight;
[sourceImage drawInRect:thumbnailRect];
newImage = UIGraphicsGetImageFromCurrentImageContext();
if(newImage == nil)
NSLog(@"could not scale image");
//pop the context to get back to the default
UIGraphicsEndImageContext();
return newImage;
}
@end
> Feature request: ability to downsize pictures with camera.getPicture (no crop)
> ------------------------------------------------------------------------------
>
> Key: CB-54
> URL: https://issues.apache.org/jira/browse/CB-54
> Project: Apache Callback
> Issue Type: New Feature
> Components: iOS
> Reporter: Shazron Abdullah
>
> reported at: https://github.com/phonegap/phonegap-iphone/issues/287
> by: https://github.com/patdenice
> Hi,
> We're working on a mobile application using phonegap. The application is designed to upload photos from the smartphone/tablet to a Piwigo gallery. Piwigo is a popular open source web application to create photo galleries. The application "Piwigo for iOS/Android" is nearly complete, we just need the ability to downsize photos before upload. Unfortunately, targetWidth and targetHeight parameters on camera.getPicture method are designed to crop the photo, which is what we're seeking. Would it be possible to add maxWidth/maxHeight parameters and resize algorithm ?
> Thanks.
> P@t
> Piwigo Team.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CB-54) Feature request: ability to downsize
pictures with camera.getPicture (no crop)
Posted by "Shazron Abdullah (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-54?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Shazron Abdullah updated CB-54:
-------------------------------
Fix Version/s: (was: 1.6.1)
1.7.0
> Feature request: ability to downsize pictures with camera.getPicture (no crop)
> ------------------------------------------------------------------------------
>
> Key: CB-54
> URL: https://issues.apache.org/jira/browse/CB-54
> Project: Apache Callback
> Issue Type: Bug
> Components: iOS
> Reporter: Shazron Abdullah
> Assignee: Shazron Abdullah
> Fix For: 1.7.0
>
>
> reported at: https://github.com/phonegap/phonegap-iphone/issues/287
> by: https://github.com/patdenice
> Hi,
> We're working on a mobile application using phonegap. The application is designed to upload photos from the smartphone/tablet to a Piwigo gallery. Piwigo is a popular open source web application to create photo galleries. The application "Piwigo for iOS/Android" is nearly complete, we just need the ability to downsize photos before upload. Unfortunately, targetWidth and targetHeight parameters on camera.getPicture method are designed to crop the photo, which is what we're seeking. Would it be possible to add maxWidth/maxHeight parameters and resize algorithm ?
> Thanks.
> P@t
> Piwigo Team.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-54) Feature request: ability to downsize
pictures with camera.getPicture (no crop)
Posted by "Shazron Abdullah (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-54?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13226357#comment-13226357 ]
Shazron Abdullah commented on CB-54:
------------------------------------
Escalating as a bug, not new feature. Related: https://github.com/apache/incubator-cordova-ios/pull/5
"no crop" should be the default like the other platforms
> Feature request: ability to downsize pictures with camera.getPicture (no crop)
> ------------------------------------------------------------------------------
>
> Key: CB-54
> URL: https://issues.apache.org/jira/browse/CB-54
> Project: Apache Callback
> Issue Type: New Feature
> Components: iOS
> Reporter: Shazron Abdullah
> Priority: Minor
> Fix For: 1.6.0
>
>
> reported at: https://github.com/phonegap/phonegap-iphone/issues/287
> by: https://github.com/patdenice
> Hi,
> We're working on a mobile application using phonegap. The application is designed to upload photos from the smartphone/tablet to a Piwigo gallery. Piwigo is a popular open source web application to create photo galleries. The application "Piwigo for iOS/Android" is nearly complete, we just need the ability to downsize photos before upload. Unfortunately, targetWidth and targetHeight parameters on camera.getPicture method are designed to crop the photo, which is what we're seeking. Would it be possible to add maxWidth/maxHeight parameters and resize algorithm ?
> Thanks.
> P@t
> Piwigo Team.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira