// Image preview functionality for Sharey
// Helper function to check if file is an image
function isImageFile(file) {
    const imageTypes = ['image/jpeg', 'image/jpg', 'image/png', 'image/gif', 'image/webp', 'image/svg+xml', 'image/bmp'];
    return imageTypes.includes(file.type.toLowerCase());
}

// Helper function to create image preview
function createImagePreview(fileUrl, fileName) {
    const preview = document.createElement('div');
    preview.className = 'image-preview';
    preview.style.cssText = `
        margin: 15px 0;
        text-align: center;
        border: 2px solid #e0e0e0;
        border-radius: 8px;
        padding: 15px;
        background: #f9f9f9;
    `;
    
    const img = document.createElement('img');
    img.src = fileUrl;
    img.alt = fileName;
    img.style.cssText = `
        max-width: 100%;
        max-height: 300px;
        border-radius: 4px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        object-fit: contain;
    `;
    
    // Handle image load errors
    img.onerror = () => {
        preview.innerHTML = '<p style="color: #666; font-style: italic;">📷 Image preview not available</p>';
    };
    
    preview.appendChild(img);
    return preview;
}
