Added logic to show captured image
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled

This commit is contained in:
dhanabalan
2026-05-25 15:55:45 +05:30
parent 7435928fcf
commit 575d3675cf

View File

@@ -3,6 +3,7 @@
cameraActive: false, cameraActive: false,
captured: false, captured: false,
errorMessage: '', errorMessage: '',
photoData: '',
async startCamera() { async startCamera() {
this.errorMessage = ''; this.errorMessage = '';
@@ -38,6 +39,7 @@
} }
this.cameraActive = false; this.cameraActive = false;
this.captured = true; this.captured = true;
this.photoData = photoData;
// Send photo data to PHP via Livewire // Send photo data to PHP via Livewire
$wire.setPhoto(photoData); $wire.setPhoto(photoData);
@@ -45,6 +47,7 @@
retake() { retake() {
this.captured = false; this.captured = false;
this.photoData = '';
$wire.clearPhoto(); $wire.clearPhoto();
this.$nextTick(() => this.startCamera()); this.$nextTick(() => this.startCamera());
} }
@@ -84,7 +87,8 @@
{{-- ── Captured photo preview (shown after capture) ── --}} {{-- ── Captured photo preview (shown after capture) ── --}}
<div x-show="captured" style="position: relative;"> <div x-show="captured" style="position: relative;">
<img <img
x-bind:src="$refs.canvas ? $refs.canvas.toDataURL('image/jpeg') : ''" {{-- x-bind:src="$refs.canvas ? $refs.canvas.toDataURL('image/jpeg') : ''" --}}
x-bind:src="photoData"
style=" style="
width: 100%; width: 100%;
max-width: 480px; max-width: 480px;