diff --git a/src/screens/Biometric/FaceRecognition/Section/Search.jsx b/src/screens/Biometric/FaceRecognition/Section/Search.jsx index da520ec..459c2a3 100644 --- a/src/screens/Biometric/FaceRecognition/Section/Search.jsx +++ b/src/screens/Biometric/FaceRecognition/Section/Search.jsx @@ -135,6 +135,8 @@ const Search = () => { // Store the uploaded file setUploadedFile(file); + setFile(file); + setSelectedImageName(file.name); // Check file size (2MB = 2 * 1024 * 1024 bytes) const maxSize = 2 * 1024 * 1024; @@ -146,7 +148,7 @@ const Search = () => { return; } - // Check file type using both extension and MIME type + // Check file type const fileExtension = file.name.split('.').pop().toLowerCase(); const validExtensions = ['jpg', 'jpeg']; const validMimeTypes = ['image/jpeg', 'image/jpg']; @@ -159,28 +161,11 @@ const Search = () => { return; } - // Create preview URL for the uploaded image + // Create preview URL const previewUrl = URL.createObjectURL(file); // Check image dimensions const img = new Image(); - img.onload = () => { - URL.revokeObjectURL(previewUrl); - - if (img.width > 300 || img.height > 300) { - setImageError('Image dimensions must not exceed 300x300 pixels'); - setFile(null); - setSelectedImageName(''); - setUploadedFile(null); - return; - } - - // All validations passed - setSelectedImageName(file.name); - setFile(file); - setImageError(''); - }; - img.onerror = () => { URL.revokeObjectURL(previewUrl); setImageError('Invalid image file'); @@ -714,60 +699,72 @@ const Search = () => { {/* Upload Section */}
Drag and Drop Here
-Or
- fileInputRef.current.click()}>Browse -Recommended size: 300x300 (Max File Size: 2MB)
-Supported file types: JPG, JPEG
-Drag and Drop Here
+Or
+ Browse +Recommended size: 320x200 (Max File Size: 2MB)
+Supported file types: JPG, JPEG
+File: {selectedImageName}
- {file && ( -- Size: {formatFileSize(file.size)} -
- )} - -File: {selectedImageName}
+ {file && ( ++ Size: {formatFileSize(file.size)} +
+ )} + +