backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 39 forks source link

Uploading images via the phone camera is broken on iOS #4185

Open klonos opened 4 years ago

klonos commented 4 years ago

Description of the bug Back in version 1.4 we added the ability to select an image from a mobile device's camera. Sometime since then, we lost it. We should find out how that happened and add it back.

Heres the markup for current input element:

<input data-file-auto-upload="1" data-file-extensions="png,gif,jpg,jpeg" accept="*/*,capture=camera" type="file" id="edit-field-image-und-0-upload" name="files[field_image_und_0]" size="22" class="form-file validate-extension-processed auto-upload-processed">

I think the problem maybe accept="*/*,capture=camera". That may need to be accept="image/*,capture=camera" for iOS.

Steps To Reproduce To reproduce the behavior:

  1. Log into a clean backdrop install from your iPhone or iPad.
  2. Create a post, and scroll to the image field.
  3. Click "upload" and see if you can browse through your camera.

Actual behavior Unable to open images in the camera app iphone

Expected behavior I should be able to load photos from my camera on an iPhone

Additional information Add any other information that could help, such as:

Recommended Solution

Since we are only addressing about image fields in the PR, the change should not have any negative side affects.

This will NOT solve the problem for file fields that also allow images, those will still be unable to select images from the camera on iOS devices.


Original issue:

I've been owning Android phones for many years now, so I have not noticed this, but I have recently asked a colleague to confirm this for me on their iPhone, and it is indeed broken.

Can we please have a few more people test in various Apple devices and confirm?


PR: https://github.com/backdrop/backdrop/pull/3064

Advocate: @laryn

Retsell commented 3 years ago

A work-around for this issue was reported in the Forum by amilenkov. It is to install the File Resumable Upload module, https://backdropcms.org/project/file_resup. See: https://forum.backdropcms.org/forum/upload-images-not-working-ios-devices

klonos commented 3 years ago

Thanks for that info @Retsell ...I still want us to fix this in core properly. It's just that last time I had a look, it wasn't as simple as it seemed, and since this requires testing in multiple devices/browsers, it'll take some time. I still want to get back to this eventually.

Retsell commented 3 years ago

@klonos, Yes, the issue still must be resolved. The work-around only applies to image fields, but not to image uploads using Ckeditor, or for image fields on Webforms.

jenlampton commented 3 years ago

If this is not a problem in D7, perhaps a quick fix would be to revert the change we added to make uploads work on mobile devices?

Retsell commented 3 years ago

I can confirm that in D7 image uploads work properly on iOS devices.

laryn commented 3 years ago

I recently got an iOS testing device so thought I'd look at this issue. I added this on the latest PR as well, but for the record:

I've done a little spitballing and if I unset this "capture" attribute completely, iOS will then give the option to select from Photo Library, Take Photo, or Browse. If "capture" is there and blank, or filled with "camera" or "capture" then it goes straight to the camera.

And I've just tested in Firefox on Android and it also seems to give the option to select from Camera, or Files.

Do we need this "capture" attribute at all?

laryn commented 3 years ago

It seems that maybe "camera" is not even a valid value for this "capture" attribute!

klonos commented 3 years ago

Hmm 🤔 ...I'll have another look as soon as possible.

Either way, I don't think that this will be able to make it for the upcoming 1.19.4.

Retsell commented 3 years ago

Do we need this "capture" attribute at all?

No, I don't think we do. "Take Photo" will accomplish the same thing. But "Photo Library" and "Browse" are the most important options.

mazzech commented 3 years ago

I just have a customer inquiry which should make camera access available for the webform data field... would this milestone also fix this?

laryn commented 2 years ago

I think I'm going to advocate for this issue. @jenlampton Are you interested in revising your PR or do you mind if I revise it?

izmeez commented 1 year ago

Is this fix going to get in to 1.26.0 ?

laryn commented 1 year ago

Thanks for raising again. I may try to create an alternate PR this week and if you can test we may be able to get it in.

izmeez commented 1 year ago

@laryn Thanks for the comment. As I look through this looong issue again I can see it hasn't fully come to rest. I also see a lot of the work has been done in two PR's: PR3064 and PR11. Also your comment appears to be the last kick at the can. Also a work around was offered in another comment:

A work-around for this issue was reported in the Forum by amilenkov. It is to install the File Resumable Upload module, https://backdropcms.org/project/file_resup. See: https://forum.backdropcms.org/forum/upload-images-not-working-ios-devices

izmeez commented 1 year ago

Maybe it is too much to expect this to be resolved in the short time remaining before the 1.26.0 release?