Add debugging to ScreenshotGallery component
- Add console logging for props, screenshot data, and image loading - Add onLoad event to track successful image loads - Add more detailed error logging for failed images - Debug data flow to identify why gallery preview/enlargement not working
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import fs from 'fs/promises'
|
||||
import path from 'path'
|
||||
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
context: any
|
||||
) {
|
||||
try {
|
||||
const screenshotsDir = path.join(process.cwd(), 'screenshots')
|
||||
const filePath = path.join(screenshotsDir, context.params.filename)
|
||||
const file = await fs.readFile(filePath)
|
||||
return new NextResponse(file, {
|
||||
headers: {
|
||||
'Content-Type': 'image/png',
|
||||
'Content-Disposition': `inline; filename="${context.params.filename}"`
|
||||
}
|
||||
})
|
||||
} catch (e: any) {
|
||||
return NextResponse.json({ error: e.message }, { status: 404 })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user