Auto commit: 2025-11-20T12:34:31.391Z

This commit is contained in:
Flatlogic Bot 2025-11-20 12:34:31 +00:00
parent 7ceedc82a3
commit a04ddd5be8
10 changed files with 30 additions and 3 deletions

View File

@ -41,7 +41,27 @@ document.addEventListener('DOMContentLoaded', function () {
processingMessage.style.display = 'none';
if (data.success && data.filePath) {
uploadedFilePath = data.filePath;
const fileExtension = uploadedFilePath.split('.').pop().toLowerCase();
const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'tiff', 'bmp', 'webp'];
const imagePreview = document.getElementById('image-preview');
const pdfPreview = document.getElementById('pdf-preview');
const pdfFilename = document.getElementById('pdf-filename');
imagePreview.style.display = 'none';
pdfPreview.style.display = 'none';
if (imageExtensions.includes(fileExtension)) {
imagePreview.src = uploadedFilePath;
imagePreview.style.display = 'block';
} else if (fileExtension === 'pdf') {
pdfFilename.textContent = uploadedFilePath.split('/').pop();
pdfPreview.style.display = 'block';
} else {
pdfFilename.textContent = "Unsupported file type for preview: " + uploadedFilePath.split('/').pop();
pdfPreview.style.display = 'block';
}
previewContainer.style.display = 'block';
document.getElementById('translation-form').style.display = 'none';
startTranslationBtn.style.display = 'block';

Binary file not shown.

After

Width:  |  Height:  |  Size: 890 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View File

@ -97,7 +97,14 @@
<div id="preview-container" class="text-center" style="display: none;">
<h5 class="mt-4">Document Preview</h5>
<img id="image-preview" src="#" alt="Image Preview" class="img-fluid rounded border" style="max-height: 400px;"/>
<img id="image-preview" src="#" alt="Image Preview" class="img-fluid rounded border" style="max-height: 400px; display: none;"/>
<div id="pdf-preview" class="py-5" style="display: none;">
<i class="bi bi-file-earmark-pdf-fill text-danger" style="font-size: 4rem;"></i>
<p id="pdf-filename" class="mt-2 mb-0"></p>
</div>
<div class="d-grid mt-3">
<button type="button" id="start-translation-btn" class="btn btn-primary btn-lg" style="display: none;">
<i class="bi bi-stars"></i> Translate

View File

@ -50,7 +50,7 @@ $file_name = uniqid('doc_') . '.' . $file_extension;
$target_path = $upload_dir . $file_name;
if (move_uploaded_file($file['tmp_name'], $target_path)) {
$web_path = 'uploads/' . $file_name;
$web_path = '/uploads/' . $file_name;
json_response(true, 'File uploaded successfully.', $web_path);
} else {
json_response(false, 'Failed to move uploaded file.');

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 KiB