debug: add comprehensive logging for image preview issue
Added detailed logging at every step of the image conversion and preview: ImageMagick Service: - Log input and output sizes - Log applied quality settings - Verify result is not empty before creating blob - Log created blob size and MIME type - Fail early if conversion produces empty result Preview Component: - Log blob details (size, type, URL) - Add onError handler to img tag with detailed error info - Add onLoad handler to confirm successful loading - Console logs will help identify: - Is the blob empty? - Is the MIME type correct? - Is the object URL valid? - What error occurs when loading? TypeScript Fix: - Changed result type to `Uint8Array | undefined` - Allows proper checking before blob creation This will help diagnose why the preview image appears broken despite successful conversion. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -68,6 +68,14 @@ export function ConversionPreview({ job, onDownload }: ConversionPreviewProps) {
|
||||
|
||||
const category = job.outputFormat.category;
|
||||
|
||||
// Log blob details for debugging
|
||||
console.log('[Preview] Blob details:', {
|
||||
size: job.result.size,
|
||||
type: job.result.type,
|
||||
previewUrl,
|
||||
outputFormat: job.outputFormat.extension,
|
||||
});
|
||||
|
||||
switch (category) {
|
||||
case 'image':
|
||||
return (
|
||||
@@ -76,6 +84,17 @@ export function ConversionPreview({ job, onDownload }: ConversionPreviewProps) {
|
||||
src={previewUrl}
|
||||
alt="Converted image preview"
|
||||
className="max-w-full max-h-64 object-contain"
|
||||
onError={(e) => {
|
||||
console.error('[Preview] Image failed to load:', {
|
||||
src: previewUrl,
|
||||
blobSize: job.result?.size,
|
||||
blobType: job.result?.type,
|
||||
error: e,
|
||||
});
|
||||
}}
|
||||
onLoad={() => {
|
||||
console.log('[Preview] Image loaded successfully');
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user