Index: lams_central/src/java/org/lamsfoundation/lams/web/PortraitSaveAction.java =================================================================== diff -u -r9832d1f0f1e57a22b92883c0a89d03b77e84ec8b -rba7ef9fb0209892892930cb3583066b70880b08b --- lams_central/src/java/org/lamsfoundation/lams/web/PortraitSaveAction.java (.../PortraitSaveAction.java) (revision 9832d1f0f1e57a22b92883c0a89d03b77e84ec8b) +++ lams_central/src/java/org/lamsfoundation/lams/web/PortraitSaveAction.java (.../PortraitSaveAction.java) (revision ba7ef9fb0209892892930cb3583066b70880b08b) @@ -105,22 +105,16 @@ //Create nice file name. If file name equals to "blob" - it means it was uploaded using webcam String fileNameWithoutExt; - boolean isUploadedFromWebcam = false; if (fileName.equals("blob")) { HttpSession ss = SessionManager.getSession(); UserDTO userDTO = (UserDTO) ss.getAttribute(AttributeNames.USER); fileNameWithoutExt = userDTO.getLogin() + "_portrait"; - isUploadedFromWebcam = true; } else { fileNameWithoutExt = fileName.substring(0, fileName.indexOf('.')); } // upload to the content repository - if (!isUploadedFromWebcam) { - //resize - is = ResizePictureUtil.resize(file.getInputStream(), LARGEST_DIMENSION_ORIGINAL); - } originalFileNode = getCentralToolContentHandler().uploadFile(is, fileNameWithoutExt + "_original.png", "image/png"); is.close(); Index: lams_central/web/includes/javascript/webrtc-capturestill.js =================================================================== diff -u -r4e48bcd112ec0b3f9ff808e3c9378a6d556f693e -rba7ef9fb0209892892930cb3583066b70880b08b --- lams_central/web/includes/javascript/webrtc-capturestill.js (.../webrtc-capturestill.js) (revision 4e48bcd112ec0b3f9ff808e3c9378a6d556f693e) +++ lams_central/web/includes/javascript/webrtc-capturestill.js (.../webrtc-capturestill.js) (revision ba7ef9fb0209892892930cb3583066b70880b08b) @@ -6,7 +6,7 @@ // width to the value defined here, but the height will be // calculated based on the aspect ratio of the input stream. - var width = 460; // We will scale the photo width to this + var width = 0; // We will scale the photo width to this var height = 0; // This will be computed based on the input stream // |streaming| indicates whether or not we're currently streaming @@ -21,7 +21,7 @@ var canvas = null; var photo = null; var startbutton = null; - //*LAMS* var added by LAMS. It will hold a URL representing the webcamera picture. It get created by URL.createObjectURL() method. + //*LAMS* var added by LAMS. It will hold a URL representing the webcamera picture. It gets created by URL.createObjectURL() method. var objectURL; function startup() { @@ -64,7 +64,16 @@ video.addEventListener('canplay', function(ev){ if (!streaming) { - height = video.videoHeight / (video.videoWidth/width); + //*LAMS* modified by LAMS + var videoHeight = video.videoHeight; + var videoWidth = video.videoWidth; + if (videoWidth > videoHeight) { + height = PORTRAIT_SIZE; + width = (videoWidth*height)/videoHeight; + } else { + width = PORTRAIT_SIZE; + height = (videoHeight*width)/videoWidth; + } // Firefox currently has a bug where the height can't be read from // the video, so we will make assumptions if this happens. @@ -112,13 +121,27 @@ //*LAMS* added by LAMS. Creates a Blob object representing the image contained in the canvas. Which we then display in photo img. canvas.toBlob(function(blob) { - $("#still-portrait").show(); - $('html, body').animate({ + $("#still-portrait").show(); + $('html, body').animate({ scrollTop: $("#still-portrait").offset().top }, 2000); - + + //create object URL objectURL = URL.createObjectURL(blob); - photo.src = objectURL; + + //display croppie + if (!croppieWidget) { + croppieWidget = $('#photo').croppie({ + viewport: { + width: PORTRAIT_SIZE, + height: PORTRAIT_SIZE + }, + boundary: { width: width, height: height }, + }); + } + croppieWidget.croppie('bind', { + url: objectURL + }); }); //*LAMS* commented out by LAMS Index: lams_central/web/portrait.jsp =================================================================== diff -u -r507ebdec972f001e5740565a0a7da8196f994234 -rba7ef9fb0209892892930cb3583066b70880b08b --- lams_central/web/portrait.jsp (.../portrait.jsp) (revision 507ebdec972f001e5740565a0a7da8196f994234) +++ lams_central/web/portrait.jsp (.../portrait.jsp) (revision ba7ef9fb0209892892930cb3583066b70880b08b) @@ -11,6 +11,7 @@ + @@ -38,7 +39,14 @@ + + @@ -109,8 +153,8 @@
- - + +
@@ -120,20 +164,18 @@
- + -
- <fmt:message key='label.screen.capture.will.appear.in.this.box' /> +
@@ -146,28 +188,33 @@
- +
-
+
- - - +

-

+

+
+ + + +
-
+