Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

allow immediate upload of picture taken mobile device camera #389

Closed
rnicholus opened this issue Oct 3, 2012 · 23 comments
Closed

allow immediate upload of picture taken mobile device camera #389

rnicholus opened this issue Oct 3, 2012 · 23 comments
Assignees
Labels
Milestone

Comments

@rnicholus
Copy link
Member

No description provided.

@ghost ghost assigned rnicholus Oct 3, 2012
@heralight
Copy link

+1

@rnicholus
Copy link
Member Author

I think this already works in Android, though some testing will be required. A bit of work may be required to make this function properly in IOS6. The primary use case here is for mobile devices.

I'm not sure I plan on making this work for desktop machines with USB-connected or built-in laptop cameras. This will require a bit more work and UI considerations. Essentially, I will need to provide a "snap picture" button for non-mobile devices along with a window to display the video from the camera if I want to support desktop/laptop cameras as well. It's not clear that this would be worth the effort, as I'm not sure many people (if anyone) would find this feature useful on a non-mobile device.

Is anyone interested in uploading pictures from non-mobile devices?

@rnicholus
Copy link
Member Author

Works fine without any changes on the stock browser in Android 4.0.4. I remember this also working in Android 2.3.6, but I'll need to confirm. Some adjustments may be needed for IOS6 (to allow access to the camera). Still need to test on the Surface tablet. If IOS6 only needs a specific value for the input element's accept attribute, I'll probably just document that.

@rnicholus
Copy link
Member Author

Surface tablet photos work as is.

IOS6 has a strange restriction here. The multiple attribute of the input element MUST be false or not present, along with a value of "image/*;capture=camera" on the input's accept attribute. This means that users can either upload a picture via the camera, or select multiple files at once, and not both. This essentially requires the integrator to make a difficult decision if uploading via the camera on IOS6 is a desired feature. I'll need to give this some thought. Ideally, I'd like to make it possible to either switch between the two modes in IOS6 (camera access vs multiple file selection) or simply work some magic to make both possible simultaneously.

@rnicholus
Copy link
Member Author

So, there are a few ways I can deal with the IOS6 restriction (see my comment above this one).

  • Do nothing, and simply instruct integrators who want to allow users to upload pictures taken directly from the camera in IOS6 to set the multiple option to false and ensure this value is included in the acceptFiles option: "image/_;capture=camera". _Pro:* No changes/complexity added to the code. Con: Users will not be able to select multiple files at once if these two options are set.
  • Provide a new option, allowCameraAccess, that, when set to true, will set the options described in the previous bullet-point automatically. Pro: Easier for integrators. Con: Same as previous bullet-point.
  • Provide a new API function, setCameraAccess, that, when set, sets or unsets the options described in the first bullet-point. Pro: Allows integrator to switch between multiple file selection and camera access without re-instantiating Fine Uploader. Cons: Adds more complexity to the code. Will need to consider designing some sort of optional toggle-switch for FineUploader mode's default UI.

I could probably combine the last two bullet points as well.

Thoughts?

@rnicholus
Copy link
Member Author

If I don't receive any feedback on my last comment within the next few days, I'm going to bump this to 3.6.

@heralight Since you +1'd this, do you have any thoughts, by any chance?

@rnicholus
Copy link
Member Author

Bumping this to 3.6, or until I get some feedback.

@ghost
Copy link

ghost commented Apr 17, 2013

I think it would be a very cool feature. Maybe for mobile devises it is more important, than selecting multiple files.

@Sydney-o9
Copy link

+1 very cool feature

@rnicholus
Copy link
Member Author

@Sydney-o9 Can you please comment on my last message in this thread?

Note that this already works without any code adjustments for all Android devices, as well as the surface tablet. The tricky part involves iOS devices. Please read my last two long messages in this issue for more details.

@mikemaccana
Copy link

The main issue here seems to be that FineUploader currently assumes a single file upload button. Why not allow multiple file upload buttons which can be configured with different options?

buttons: {
  '#uploadPictures':{
    multiple: True,
  },
  '#takePictureFromCamera':{
    camera: True,
  },
}

['Upload pictures']
['Take picture with camera']

Users can pick the option they prefer.

@rnicholus
Copy link
Member Author

Hi @mikemaccana! I thought, briefly, about a second button, but this would only serve a purpose for iOS6 devices. Android and even the Surface Tablet (and presumably Windows Mobile devices) are capable of ingesting from the camera and the filesystem (multiple files) with the same button. Plus, requiring a second button certainly adds complexity to the library. I'm not sure that complexity is justifiable in this case.

I'm thinking that it may be sufficient to have iOS users choose between camera access and multiple file selection. Integrators can always create their own second file input element, properly configured, that can be used exclusively for camera access, if they wish. They can submit the <input> or the File (after the picture has been snapped) to the addFiles API method, and Fine Uploader will take it from there.

Your suggestion did make me think about multiple file input elements, though. As I mentioned, it is fairly easy for integrators to create multiple file input elements and then pass them off to Fine Uploader on the associated onChange handler, but styling it is a bit less trivial without Fine Uploader's help. So, I created case #819. Let me know what you think.

@JasonBoland
Copy link

I think it would make sense that if the browser detects an iPhone then multiple is turned off by a setting of some kind.

We're doing a check on our side and if the user is on a iPhone/iPad we set multiple = false.

@rnicholus
Copy link
Member Author

@JasonBoland That's the direction I'm leaning.

@JasonBoland
Copy link

However having the option for two buttons is also a good concept. Something like "Upload Existing" and "Open Camera". But for that option we can code it ourselves.

@rnicholus
Copy link
Member Author

I think two buttons would only be useful or make sense for iOS users, since the 2nd button is unnecessary for other mobile OS users. You certainly could have a 2nd button that only appears for iOS users, but maybe it isn't that important for iOS users (or any mobile users) to select multiple files and upload via the camera anyway. I'm still leaning towards an iOS-specific option that would disable the multiple option and set the correct accept attribute on the associated file input. In the future, I may make use of getUserMedia to allow uploads via a desktop camera (#829), and this may require a second button.

@rnicholus
Copy link
Member Author

I think this has sat long enough. I'll proceed in 3.6 as described in my last few posts.

@rnicholus
Copy link
Member Author

Working on this for 3.6...

@JasonBoland
Copy link

Great!

rnicholus pushed a commit that referenced this issue May 9, 2013
@rnicholus
Copy link
Member Author

I've completed this feature for 3.6 (currently in the develop branch). You can read about all the gory details in my blog post on this feature.

@ncintra
Copy link

ncintra commented May 13, 2013

great stuff @rnicholus !!! Looking forward for the desktop camera support you mentioned above.

@rnicholus
Copy link
Member Author

You can track progress on that specific feature in case #829.

On Monday, May 13, 2013, ncintra wrote:

great stuff @rnicholus https://github.com/rnicholus !!! Looking forward
for the desktop camera support you mentioned above.


Reply to this email directly or view it on GitHubhttps://github.com//issues/389#issuecomment-17805810
.

@brunomac
Copy link

+1 !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants