Bugzilla – Attachment 106939 Details for
Bug 6815
Capture member photo via webcam
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6815: Attempt to get sandbox to work
Bug-6815-Attempt-to-get-sandbox-to-work.patch (text/plain), 8.00 KB, created by
Mark Tompsett
on 2020-07-15 20:31:30 UTC
(
hide
)
Description:
Bug 6815: Attempt to get sandbox to work
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2020-07-15 20:31:30 UTC
Size:
8.00 KB
patch
obsolete
>From 1a999cbaf6a8a1d17205c029df1e13f0da9c42d4 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Wed, 15 Jul 2020 20:30:55 +0000 >Subject: [PATCH] Bug 6815: Attempt to get sandbox to work > >--- > .../en/modules/members/moremember-patronimage.tt | 142 ++++++++++++--------- > 1 file changed, 84 insertions(+), 58 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-patronimage.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-patronimage.tt >index 3db86fab46..9733e6140f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-patronimage.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-patronimage.tt >@@ -53,42 +53,63 @@ > > <script> > function turn_on() { >- // Detect camera >- navigator.getMedia = ( navigator.getUserMedia || >- navigator.webkitGetUserMedia || >- navigator.mozGetUserMedia || >- navigator.msGetUserMedia ); >- if (navigator.getMedia) { >- // keep it on, and set object sizes >- navigator.getMedia( >- {video: true}, >+ if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { >+ navigator.mediaDevices.getUserMedia({video: true}).then( > function(stream) { >- var takebutton = document.getElementById('webcam_capture'); >- var savebutton = document.getElementById('webcam_save'); >- var video = document.getElementById('videoFeed'); >- var canvas = document.getElementById('canvas'); >- var picture = document.getElementById('picture'); > video.srcObject = stream; >- video.autoplay = true; >+ video.play(); > // use 200ms timeout to set because mobile switches height/width > // until used and the videoWidth and videoHeight are checked > setTimeout(function(){ >- width = video.videoWidth; >- height = video.videoHeight; >+ var width = video.videoWidth; >+ var height = video.videoHeight; > var ratio = height.toFixed(6)/width.toFixed(6); > var rheight = 240 * ratio; > video.height = rheight; > canvas.height = rheight; > picture.height = rheight; >- takebutton.disabled = false; >+ takepicture.disabled = false; > }, 200); >- }, >- function() { >- alert('Webcam not detected or permission denied!'); > } > ); > } else { >- alert('Webcam not detected or permission denied!'); >+ // Detect camera >+ navigator.getMedia = ( navigator.getUserMedia || >+ navigator.webkitGetUserMedia || >+ navigator.mozGetUserMedia || >+ navigator.msGetUserMedia ); >+ if (navigator.getMedia) { >+ // keep it on, and set object sizes >+ navigator.getMedia( >+ {video: true}, >+ function(stream) { >+ var takebutton = document.getElementById('webcam_capture'); >+ var savebutton = document.getElementById('webcam_save'); >+ var video = document.getElementById('videoFeed'); >+ var canvas = document.getElementById('canvas'); >+ var picture = document.getElementById('picture'); >+ video.srcObject = stream; >+ video.autoplay = true; >+ // use 200ms timeout to set because mobile switches height/width >+ // until used and the videoWidth and videoHeight are checked >+ setTimeout(function(){ >+ width = video.videoWidth; >+ height = video.videoHeight; >+ var ratio = height.toFixed(6)/width.toFixed(6); >+ var rheight = 240 * ratio; >+ video.height = rheight; >+ canvas.height = rheight; >+ picture.height = rheight; >+ takebutton.disabled = false; >+ }, 200); >+ }, >+ function() { >+ alert('Webcam not detected or permission denied!'); >+ } >+ ); >+ } else { >+ alert('Webcam not detected or permission denied!'); >+ } > } > } > >@@ -153,45 +174,18 @@ > } > </script> > <script> >- //if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { >- // navigator.mediaDevices.getUserMedia(mediaConfig).then( >- // function(stream) { >- // video.srcObject = stream; >- // video.play(); >- // } >- // ); >- //} >- >+ var video = document.getElementById('videoFeed'); >+ var canvas = document.getElementById('canvas'); >+ var picture = document.getElementById('picture'); > var takepicture = document.getElementById('webcam_capture'); > var savepicture = document.getElementById('webcam_save'); > savepicture.disabled = true; > >- // Detect camera >- navigator.getMedia = ( navigator.getUserMedia || >- navigator.webkitGetUserMedia || >- navigator.mozGetUserMedia || >- navigator.msGetUserMedia ); >- // If no camera... >- if (! navigator.getMedia) { >- // Disable the buttons. >- var webcamoff = document.getElementById('webcam_off'); >- var webcamon = document.getElementById('webcam_on'); >- webcamon.disabled = true; >- webcamoff.disabled = true; >- takepicture.disabled = true; >- document.getElementById('capture-patron-image').style.visibility = "hidden"; >- document.getElementById('capture-patron-image').remove(); >- } else { >- // If camera... >- // keep it on and set objects height and width >- navigator.getMedia( >- {video: true}, >+ if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { >+ navigator.mediaDevices.getUserMedia({video: true}).then( > function(stream) { >- var video = document.getElementById('videoFeed'); >- var canvas = document.getElementById('canvas'); >- var picture = document.getElementById('picture'); > video.srcObject = stream; >- video.autoplay = true; >+ video.play(); > // use 200ms timeout to set because mobile switches height/width > // until used and the videoWidth and videoHeight are checked > setTimeout(function(){ >@@ -204,11 +198,43 @@ > picture.height = rheight; > takepicture.disabled = false; > }, 200); >- }, >- function() { >- alert('Webcam not detected or permission denied!'); > } > ); >+ } else { >+ // Detect camera >+ navigator.getMedia = ( navigator.getUserMedia || >+ navigator.webkitGetUserMedia || >+ navigator.mozGetUserMedia || >+ navigator.msGetUserMedia ); >+ // If camera... >+ if (navigator.getMedia) { >+ // keep it on and set objects height and width >+ navigator.getMedia( >+ {video: true}, >+ function(stream) { >+ video.srcObject = stream; >+ video.autoplay = true; >+ // use 200ms timeout to set because mobile switches height/width >+ // until used and the videoWidth and videoHeight are checked >+ setTimeout(function(){ >+ var width = video.videoWidth; >+ var height = video.videoHeight; >+ var ratio = height.toFixed(6)/width.toFixed(6); >+ var rheight = 240 * ratio; >+ video.height = rheight; >+ canvas.height = rheight; >+ picture.height = rheight; >+ takepicture.disabled = false; >+ }, 200); >+ }, >+ function() { >+ alert('Webcam not detected or permission denied!'); >+ } >+ ); >+ } else { >+ // Otherwise just delete the whole div section. >+ document.getElementById('capture-patron-image').remove(); >+ } > } > </script> > </html> >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6815
:
22623
|
29613
|
38518
|
91302
|
91303
|
91335
|
99015
|
99016
|
99757
|
106774
|
106775
|
106776
|
106777
|
106782
|
106783
|
106787
|
106788
|
106789
|
106790
|
106791
|
106792
|
106793
|
106794
|
106795
|
106796
|
106797
|
106798
|
106799
|
106800
|
106801
|
106802
|
106803
|
106804
|
106938
|
106939
|
106940
|
131174
|
131554
|
131985
|
131987
|
131988
|
131999
|
132000
|
132001