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">
|
||||
|
||||
</div>
|
||||
<!-- Latest Tesseract.js from CDN -->
|
||||
|
||||
|
||||
<script>
|
||||
function cameraCapture() {
|
||||
@@ -329,6 +327,12 @@ function cameraCapture() {
|
||||
canvas.height = video.videoHeight;
|
||||
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
|
||||
canvas.toBlob(async blob => {
|
||||
const file = new File([blob], 'capture.jpeg', { type: 'image/jpeg' });
|
||||
|
||||
Reference in New Issue
Block a user