Added show capture photo in ocr
This commit is contained in:
@@ -288,8 +288,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
<input type="hidden" x-ref="hiddenInput" x-model="photo1" name="camera_capture_file">
|
<input type="hidden" x-ref="hiddenInput" x-model="photo1" name="camera_capture_file">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- Latest Tesseract.js from CDN -->
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function cameraCapture() {
|
function cameraCapture() {
|
||||||
@@ -329,6 +327,12 @@ function cameraCapture() {
|
|||||||
canvas.height = video.videoHeight;
|
canvas.height = video.videoHeight;
|
||||||
context.drawImage(video, 0, 0, canvas.width, canvas.height);
|
context.drawImage(video, 0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
|
// Show snapshot
|
||||||
|
const snapshot = this.$refs.snapshot;
|
||||||
|
snapshot.src = canvas.toDataURL('image/jpeg');
|
||||||
|
snapshot.classList.remove('hidden');
|
||||||
|
video.classList.add('hidden');
|
||||||
|
|
||||||
// Convert canvas to file
|
// Convert canvas to file
|
||||||
canvas.toBlob(async blob => {
|
canvas.toBlob(async blob => {
|
||||||
const file = new File([blob], 'capture.jpeg', { type: 'image/jpeg' });
|
const file = new File([blob], 'capture.jpeg', { type: 'image/jpeg' });
|
||||||
|
|||||||
Reference in New Issue
Block a user