diff --git a/platforms/blabsy/src/components/input/image-preview.tsx b/platforms/blabsy/src/components/input/image-preview.tsx
index 3b51cf4d4..e35afc917 100644
--- a/platforms/blabsy/src/components/input/image-preview.tsx
+++ b/platforms/blabsy/src/components/input/image-preview.tsx
@@ -56,7 +56,34 @@ export function ImagePreview({
// Combine accidentally separated base64 images
const processedImages = useMemo(() => {
- return combineBase64Images(imagesPreview);
+ console.log('[ImagePreview] Raw images received:', {
+ count: imagesPreview?.length || 0,
+ images: imagesPreview?.map((img, i) => ({
+ index: i,
+ id: img.id,
+ srcPreview: img.src.substring(0, 100),
+ srcLength: img.src.length,
+ alt: img.alt,
+ type: img.type
+ }))
+ });
+
+ const processed = combineBase64Images(imagesPreview);
+
+ console.log('[ImagePreview] Processed images:', {
+ originalCount: imagesPreview?.length || 0,
+ processedCount: processed.length,
+ processed: processed.map((img, i) => ({
+ index: i,
+ id: img.id,
+ srcPreview: img.src.substring(0, 100),
+ srcLength: img.src.length,
+ alt: img.alt,
+ type: img.type
+ }))
+ });
+
+ return processed;
}, [imagesPreview]);
// Update previewCount based on processed images
diff --git a/platforms/blabsy/src/components/ui/next-image.tsx b/platforms/blabsy/src/components/ui/next-image.tsx
index d2bb1d30a..c62392366 100644
--- a/platforms/blabsy/src/components/ui/next-image.tsx
+++ b/platforms/blabsy/src/components/ui/next-image.tsx
@@ -36,6 +36,33 @@ export function NextImage({
const handleLoad = (): void => setLoading(false);
+ // Check if the image source is a base64 data URI
+ const isBase64 = typeof src === 'string' && src.startsWith('data:');
+
+ // For base64 images, use a regular img tag to avoid Next.js optimization issues
+ if (isBase64) {
+ return (
+
+
+ {children}
+
+ );
+ }
+
return (
= [];
- console.log('Processing images for base64 combining:', images.length);
-
for (let i = 0; i < images.length; i += 2) {
const dataPart = images[i];
const chunkPart = images[i + 1];
@@ -31,11 +29,6 @@ export function combineBase64Images(
) {
// Combine the base64 parts
const combinedSrc = `${dataPart.src},${chunkPart.src}`;
- console.log(`Combined base64 image at index ${i}:`, {
- original: dataPart.src.substring(0, 50) + '...',
- chunk: chunkPart.src.substring(0, 50) + '...',
- combined: combinedSrc.substring(0, 50) + '...'
- });
result.push({
...dataPart,
@@ -49,10 +42,8 @@ export function combineBase64Images(
} else {
// Handle odd number of images (last item)
if (dataPart) {
- if (dataPart.src.startsWith('data:')) {
- console.warn(
- `Incomplete base64 image at index ${i}, skipping`
- );
+ if (dataPart.src.startsWith('data:') && !dataPart.src.includes(',')) {
+ // Incomplete base64 image, skip it
} else {
result.push(dataPart);
}
@@ -60,9 +51,6 @@ export function combineBase64Images(
}
}
- console.log(
- `Processed ${images.length} images into ${result.length} valid images`
- );
return result;
}