This commit is contained in:
mohanmd 2026-06-04 12:22:15 +05:30
parent 14145bb409
commit abf9cdebde
9 changed files with 6 additions and 2 deletions

View File

@ -238,9 +238,13 @@ public function sendMessage(Request $request, $id)
$attachmentPath = $file->store('chat_attachments', 'public'); $attachmentPath = $file->store('chat_attachments', 'public');
$mime = $file->getMimeType(); $mime = $file->getMimeType();
if (str_starts_with($mime, 'image/')) { $extension = strtolower($file->getClientOriginalExtension());
$audioExtensions = ['mp3', 'wav', 'm4a', 'ogg', 'webm', 'aac', '3gp', 'amr'];
$imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'webp'];
if (str_starts_with($mime, 'image/') || in_array($extension, $imageExtensions)) {
$attachmentType = 'image'; $attachmentType = 'image';
} elseif (str_starts_with($mime, 'audio/')) { } elseif (str_starts_with($mime, 'audio/') || in_array($extension, $audioExtensions)) {
$attachmentType = 'voice'; $attachmentType = 'voice';
} else { } else {
$attachmentType = 'document'; $attachmentType = 'document';

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 KiB