Fileupload does not trigger camera on mobile CHROME

FileUpload::make('image_path')
->label('Image')
->image()
->directory('uploads/images')
->maxSize(2048)
->imagePreviewHeight('150px')
->imageEditor()
->extraAttributes([
'accept' => 'image/*',
'capture' => 'environment',
'style' => 'cursor: pointer;',
'onclick' => <<<JS
(function() {
const imageUrl = this.closest('div').querySelector('input[type=hidden]').value;
const modal = document.createElement('div');
modal.style.position = 'fixed';
modal.style.top = '0';
modal.style.left = '0';
modal.style.width = '100%';
modal.style.height = '100%';
modal.style.backgroundColor = 'rgba(0, 0, 0, 0.9)';
modal.style.zIndex = '1000';
modal.style.display = 'flex';
modal.style.justifyContent = 'center';
modal.style.alignItems = 'center';
const img = document.createElement('img');
img.src = imageUrl;
img.style.maxWidth = '90%';
img.style.maxHeight = '90%';
modal.onclick = () => {
modal.remove();
};
modal.appendChild(img);
document.body.appendChild(modal);
}).call(this); JS
]),
FileUpload::make('image_path')
->label('Image')
->image()
->directory('uploads/images')
->maxSize(2048)
->imagePreviewHeight('150px')
->imageEditor()
->extraAttributes([
'accept' => 'image/*',
'capture' => 'environment',
'style' => 'cursor: pointer;',
'onclick' => <<<JS
(function() {
const imageUrl = this.closest('div').querySelector('input[type=hidden]').value;
const modal = document.createElement('div');
modal.style.position = 'fixed';
modal.style.top = '0';
modal.style.left = '0';
modal.style.width = '100%';
modal.style.height = '100%';
modal.style.backgroundColor = 'rgba(0, 0, 0, 0.9)';
modal.style.zIndex = '1000';
modal.style.display = 'flex';
modal.style.justifyContent = 'center';
modal.style.alignItems = 'center';
const img = document.createElement('img');
img.src = imageUrl;
img.style.maxWidth = '90%';
img.style.maxHeight = '90%';
modal.onclick = () => {
modal.remove();
};
modal.appendChild(img);
document.body.appendChild(modal);
}).call(this); JS
]),
I have this code and have tried it on several mobile browsers. All seem to trigger the camera/gallery choice for the source except chrome. In chrome seems I can only select media from gallery. What am I missing?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server