slight fixes to fix the image processing
Release Inventarsystem / release-docker (push) Successful in 2m15s
Release Inventarsystem / release-docker (push) Successful in 2m15s
This commit is contained in:
+4
-4
@@ -5555,10 +5555,10 @@ def upload_item():
|
|||||||
app.logger.info(f"Starting image upload session {upload_session_id} - Files: {len(images)}, User: {encrypt_text(username)}")
|
app.logger.info(f"Starting image upload session {upload_session_id} - Files: {len(images)}, User: {encrypt_text(username)}")
|
||||||
|
|
||||||
for index, image in enumerate(images):
|
for index, image in enumerate(images):
|
||||||
if upload_mode == 'library':
|
#if upload_mode == 'library':
|
||||||
app.logger.info(f"[Upload {upload_session_id}] Skipping manual upload (Library Mode)")
|
# app.logger.info(f"[Upload {upload_session_id}] Skipping manual upload (Library Mode)")
|
||||||
skipped_count += 1
|
# skipped_count += 1
|
||||||
continue
|
# continue
|
||||||
|
|
||||||
if not image or not image.filename:
|
if not image or not image.filename:
|
||||||
skipped_count += 1
|
skipped_count += 1
|
||||||
|
|||||||
@@ -1252,7 +1252,6 @@
|
|||||||
return div.innerHTML;
|
return div.innerHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opens the modal and fetches the data
|
|
||||||
function showItemDetail(itemId) {
|
function showItemDetail(itemId) {
|
||||||
const detailContent = document.getElementById('detailContent');
|
const detailContent = document.getElementById('detailContent');
|
||||||
const detailModal = document.getElementById('detailModal');
|
const detailModal = document.getElementById('detailModal');
|
||||||
@@ -1265,11 +1264,15 @@
|
|||||||
const item = libraryItems.find(i => i._id === itemId);
|
const item = libraryItems.find(i => i._id === itemId);
|
||||||
let mediaHtml = '';
|
let mediaHtml = '';
|
||||||
|
|
||||||
if (item && item.Images && item.Images.length > 0) {
|
// Sicherstellen, dass item.Images existiert und ein Array mit Elementen ist
|
||||||
|
if (item && Array.isArray(item.Images) && item.Images.length > 0) {
|
||||||
const imagesHtml = item.Images.map((image, index) => {
|
const imagesHtml = item.Images.map((image, index) => {
|
||||||
const imageSrc = image.startsWith('/uploads/') || image.startsWith('http') ?
|
// Robuste Pfad-Generierung: Startet es nicht mit http oder /, setzen wir /uploads/ davor
|
||||||
image :
|
let imageSrc = image;
|
||||||
`{{ url_for('uploaded_file', filename='') }}${image}`;
|
if (!image.startsWith('http') && !image.startsWith('/')) {
|
||||||
|
// Passe "/uploads/" an, falls dein Server-Ordner für Bilder anders heißt (z.B. "/static/uploads/")
|
||||||
|
imageSrc = '/uploads/' + image;
|
||||||
|
}
|
||||||
|
|
||||||
const thumbnailInfo = item.ThumbnailInfo && item.ThumbnailInfo[index];
|
const thumbnailInfo = item.ThumbnailInfo && item.ThumbnailInfo[index];
|
||||||
const isVideo = isVideoFile(image);
|
const isVideo = isVideoFile(image);
|
||||||
@@ -1280,8 +1283,9 @@
|
|||||||
: imageSrc;
|
: imageSrc;
|
||||||
|
|
||||||
if (thumbnailInfo && thumbnailInfo.has_thumbnail) {
|
if (thumbnailInfo && thumbnailInfo.has_thumbnail) {
|
||||||
return `<div class="video-container" style="position: relative; width: 120px; height: 120px; display: inline-block; margin-right: 15px; margin-bottom: 15px;">
|
return `
|
||||||
<img src="${videoSrc}" alt="${escapeHtml(item.Name || '')}" class="item-image" style="width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 1px solid #ddd;">
|
<div class="video-container" style="position: relative; width: 120px; height: 120px; display: inline-block; margin-right: 15px; margin-bottom: 15px;">
|
||||||
|
<img src="${videoSrc}" alt="${escapeHtml(item.Name || 'Medium')}" class="item-image" style="width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 1px solid #ddd;">
|
||||||
<div class="video-preview-overlay" style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; background: rgba(0,0,0,0.6); border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 16px;">
|
<div class="video-preview-overlay" style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; background: rgba(0,0,0,0.6); border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 16px;">
|
||||||
▶
|
▶
|
||||||
</div>
|
</div>
|
||||||
@@ -1294,7 +1298,7 @@
|
|||||||
? thumbnailInfo.thumbnail_url
|
? thumbnailInfo.thumbnail_url
|
||||||
: imageSrc;
|
: imageSrc;
|
||||||
|
|
||||||
return `<img src="${imageSrcFinal}" alt="${escapeHtml(item.Name || '')}" class="item-image" style="width: 120px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid #ddd; margin-right: 15px; margin-bottom: 15px;">`;
|
return `<img src="${imageSrcFinal}" alt="${escapeHtml(item.Name || 'Medium')}" class="item-image" style="width: 120px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid #ddd; margin-right: 15px; margin-bottom: 15px;">`;
|
||||||
}
|
}
|
||||||
}).join('');
|
}).join('');
|
||||||
|
|
||||||
@@ -1315,7 +1319,7 @@
|
|||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error('Error loading detail:', err);
|
console.error('Error loading detail:', err);
|
||||||
detailContent.innerHTML = '<p>Sorry, we could not load the item details. Please try again later.</p>';
|
detailContent.innerHTML = '<p style="color: red;">Entschuldigung, die Details konnten nicht geladen werden. Bitte versuche es später erneut.</p>';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user