Return-Path: X-Original-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8C3A49D9A for ; Fri, 13 Apr 2012 13:37:41 +0000 (UTC) Received: (qmail 83789 invoked by uid 500); 13 Apr 2012 13:37:41 -0000 Delivered-To: apmail-incubator-callback-dev-archive@incubator.apache.org Received: (qmail 83762 invoked by uid 500); 13 Apr 2012 13:37:41 -0000 Mailing-List: contact callback-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-dev@incubator.apache.org Received: (qmail 83754 invoked by uid 99); 13 Apr 2012 13:37:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Apr 2012 13:37:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Apr 2012 13:37:38 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id D41F3368C1A for ; Fri, 13 Apr 2012 13:37:17 +0000 (UTC) Date: Fri, 13 Apr 2012 13:37:17 +0000 (UTC) From: "Shazron Abdullah (Updated) (JIRA)" To: callback-dev@incubator.apache.org Message-ID: <1053346661.21918.1334324237870.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <118924958.54836.1326940239634.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (CB-183) ios camera targetWidth/Height don't match the documentation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Shazron Abdullah updated CB-183: -------------------------------- Fix Version/s: (was: 1.6.1) 1.7.0 > ios camera targetWidth/Height don't match the documentation > ----------------------------------------------------------- > > Key: CB-183 > URL: https://issues.apache.org/jira/browse/CB-183 > Project: Apache Callback > Issue Type: Bug > Components: iOS > Affects Versions: 1.0.0 > Reporter: Durham > Assignee: Shazron Abdullah > Fix For: 1.7.0 > > > According to the [phonegap camera documentation|http://docs.phonegap.com/en/1.3.0/phonegap_camera_camera.md.html#cameraOptions] using targetWidth and targetHeight should maintain the aspect ratio of the original photo . The ios implementation does not do this. Instead it makes the shortest side match the desired target, and crops the rest. > For example, if I take a 1920x1200 picture, and say targetWidth=1024 and targetHeight=1024, it results in a 1024x1024 square picture with the excess removed. On android it results in something like 1024x640, and nothing is cropped. > I'm don't know objective-c, but I believe the fix is to use the following code inside Camera.m imageByScalingAndCroppingForSize. This is based off the android implementation. > {code:title=Camera.m} > ... > if (CGSizeEqualToSize(imageSize, targetSize) == NO) > { > CGFloat newRatio = targetWidth / targetHeight; > CGFloat origRatio = width / height; > if (origRatio > newRatio) > { > targetHeight = (targetWidth * height) / width > } > else > { > targetWidth = (targetHeight * width) / height; > } > } > CGSize finalSize = CGSizeMake(targetWidth, targetHeight); > UIGraphicsBeginImageContext(finalSize); > CGRect thumbnailRect = CGRectZero; > thumbnailRect.size.width = targetWidth; > thumbnailRect.size.height = targetHeight; > [sourceImage drawInRect:thumbnailRect]; > ... > {code} > I'm currently seeing the problem in 1.0, but from looking at the code it still looks like a problem in 1.3. -- 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