Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8613737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:57:20+00:00 2026-06-12T04:57:20+00:00

So I had an ios app, pre ios6/iPhone5. It worked well. I am currently

  • 0

So I had an ios app, pre ios6/iPhone5. It worked well. I am currently in the process of trying to fix it for iPhone5 and ios6. Was going well, and I have ironed out 99% of the bugs for ios6 and it seems to work. iPhone 5 however is being temperamental.

I am using PhoneGap 1.8.1. At one point I take an image with the camera, using this function:

function capturePhoto() {

        networkState = navigator.network.connection.type; 

            if (networkState == Connection.NONE)
                {
                  alert('You must be connected to the internet to use this feature!');

                }else{


                var options = {
                    quality: 100,
                    correctOrientation: false,
                    destinationType : navigator.camera.DestinationType.FILE_URI,
                    sourceType: navigator.camera.PictureSourceType.CAMERA,
                    encodingType: navigator.camera.EncodingType.JPEG,
              }
          navigator.camera.getPicture(onPhotoDataSuccess, onFail, options);

    }
}

I then display the image as a background on a HTML canvas. Using kineticJS but for the purposes of this problem I would think all you need to know is:

var canvaswidth = window.innerWidth;
var canvasheight = window.innerHeight;

var darthVaderImg = new Kinetic.Image({
                                          x: 0,
                                          y: 0,
                                          image: images.darthVader,
                                          width: canvaswidth,
                                          height: canvasheight,
                                          name: "image"
                                          });

This running on iphone 4s ios 6 works fine, this on android works fine… but on iPhone 5 it does not. The picture is the correct orientation, but it gets squashed up in the top, I tried hard-coding it to the screen size of the iPhone 5…. which I believe is 640×1136?

Still no luck, if I exaggerate and set the image height to 2000 for example, it does cover the screen, but is zoomed in. I am abit lost as to what is happening…. anyone had a similar problem, or any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:57:21+00:00Added an answer on June 12, 2026 at 4:57 am

    Ok, So I think I have figured this out:

    First thing to realise is that iPhone 5’s take exactly the same size picture as a iPhone 4S. I’ve just tested and confirmed this. So the extra Screen size is irrelevant.

    Once I realised this, using an article written by Simon MacDonald. Available here:

    http://simonmacdonald.blogspot.co.uk/2012/07/change-to-camera-code-in-phonegap-190.html

    I then added these two lines to my capturePhoto function:

    targetWidth: 320,
    targetHeight: 480,
    

    This ensured that the taken image was the correct size, and the added advantage is that its correct on the 4 and 5.

    I then made sure it was displayed on the canvas in the correct size, my canvas display size became:

    var canvaswidth = 320;
    var canvasheight = 480;
    
    var darthVaderImg = new Kinetic.Image({
                                              x: 0,
                                              y: 0,
                                              image: images.darthVader,
                                              width: canvaswidth,
                                              height: canvasheight,
                                              name: "image"
                                              });
    

    This keeps the image in proportion, the perfectionist in me says that its only 99% correct, but it covers the canvas and is not out of proportion.

    This does leave me with excess ‘space’ on the iPhone 5, but I just combated that with an IF statement by detecting the window height:

    window.innerHeight
    

    using this as a variable I am able to tell between iphone5 and iphone4/4s, and then I can set different rules for both, as far as display actions go.

    Hope this helps anyone who comes across the same problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an iOS app whose push notification cert has expired and we're trying
I'm trying to submit my iOS app to the App Store, I have followed
I have been building an iOS app and one of my ViewControllers had become
In a Single-View iOS app I'm currently working on, I have a view controller
I have an iOS app that I've had to rename (kept the bundle id
I'm working on an iOS app and have had some trouble with getting photos
Im thinking about learn to develop app for iOS. I had a lot of
I had a bunch of apps that worked great in iOS 4. None of
The question makes it clear.I had submitted an iOS app to app store which
I developed an ios app that had a: NSError *error; instead of: NSError *error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.