Auto commit: 2025-11-20T12:34:31.391Z
@ -41,7 +41,27 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
processingMessage.style.display = 'none';
|
processingMessage.style.display = 'none';
|
||||||
if (data.success && data.filePath) {
|
if (data.success && data.filePath) {
|
||||||
uploadedFilePath = data.filePath;
|
uploadedFilePath = data.filePath;
|
||||||
imagePreview.src = uploadedFilePath;
|
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';
|
previewContainer.style.display = 'block';
|
||||||
document.getElementById('translation-form').style.display = 'none';
|
document.getElementById('translation-form').style.display = 'none';
|
||||||
startTranslationBtn.style.display = 'block';
|
startTranslationBtn.style.display = 'block';
|
||||||
|
|||||||
BIN
assets/pasted-20251120-122957-7402e7e8.png
Normal file
|
After Width: | Height: | Size: 890 KiB |
BIN
assets/vm-shot-2025-11-20T12-31-33-320Z.jpg
Normal file
|
After Width: | Height: | Size: 59 KiB |
@ -97,7 +97,14 @@
|
|||||||
|
|
||||||
<div id="preview-container" class="text-center" style="display: none;">
|
<div id="preview-container" class="text-center" style="display: none;">
|
||||||
<h5 class="mt-4">Document Preview</h5>
|
<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">
|
<div class="d-grid mt-3">
|
||||||
<button type="button" id="start-translation-btn" class="btn btn-primary btn-lg" style="display: none;">
|
<button type="button" id="start-translation-btn" class="btn btn-primary btn-lg" style="display: none;">
|
||||||
<i class="bi bi-stars"></i> Translate
|
<i class="bi bi-stars"></i> Translate
|
||||||
|
|||||||
@ -50,7 +50,7 @@ $file_name = uniqid('doc_') . '.' . $file_extension;
|
|||||||
$target_path = $upload_dir . $file_name;
|
$target_path = $upload_dir . $file_name;
|
||||||
|
|
||||||
if (move_uploaded_file($file['tmp_name'], $target_path)) {
|
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);
|
json_response(true, 'File uploaded successfully.', $web_path);
|
||||||
} else {
|
} else {
|
||||||
json_response(false, 'Failed to move uploaded file.');
|
json_response(false, 'Failed to move uploaded file.');
|
||||||
|
|||||||
BIN
uploads/doc_691f098f382bd.jpg
Normal file
|
After Width: | Height: | Size: 355 KiB |
BIN
uploads/doc_691f09aa1efe1.jpg
Normal file
|
After Width: | Height: | Size: 355 KiB |
BIN
uploads/doc_691f09fb5e8e6.jpg
Normal file
|
After Width: | Height: | Size: 355 KiB |
BIN
uploads/doc_691f0a1c677eb.jpg
Normal file
|
After Width: | Height: | Size: 355 KiB |
BIN
uploads/doc_691f0a88360cd.jpg
Normal file
|
After Width: | Height: | Size: 355 KiB |