Images rendering as "broken icons" in screenshots (WordPress/LiteSpeed/WebP) despite magic=true and wait_for_images=true #1843
Replies: 1 comment
-
|
This is likely a lazy-loading issue, not a WebP decoding issue. Headless Chromium supports WebP fine — the problem is that WordPress/LiteSpeed lazy-load plugins use The current Try this approach — use {
"url": "https://xxxxxx.br/",
"output_path": "/screenshots/test.png",
"screenshot_wait_for": 5,
"wait_for_images": true,
"scan_full_page": true,
"scroll_delay": 1.0,
"js_code": [
"document.querySelectorAll('img[data-src]').forEach(img => { img.src = img.dataset.src; });",
"document.querySelectorAll('img[data-lazy-src]').forEach(img => { img.src = img.dataset.lazySrc; });",
"document.querySelectorAll('img[loading=lazy]').forEach(img => { img.loading = 'eager'; });",
"document.querySelectorAll('noscript').forEach(ns => { const tmp = document.createElement('div'); tmp.innerHTML = ns.innerHTML; tmp.querySelectorAll('img').forEach(img => document.body.appendChild(img)); });",
"await new Promise(r => setTimeout(r, 3000));"
]
}Key points:
If that doesn't work, also try adding The root cause is that |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug / question
Hi team! First of all, thank you for the amazing tool. I'm using the Crawl4AI Docker image (unclecode/crawl4ai:0.8.0) to capture full-page screenshots of WordPress websites, but I'm consistently getting "broken image icons" instead of the actual pictures, especially on heavy gallery sites using LiteSpeed Cache and .webp images.
To Reproduce
Target URL: https://xxxxxx.br/
Endpoint: POST /screenshot (or /crawl)
I am sending the following payload directly via curl to the container:
JSON
What I have already tried (without success):
Using the magic: true and wait_for_images: true parameters.
Injecting custom js_code to force smooth scrolling to the bottom (triggering lazy loads), removing loading="lazy" attributes, and forcing data-src to src.
Appending a cache-buster query string (?bypass=123) to bypass LiteSpeed Cache.
Saving the file directly to a mapped Docker volume (output_path) instead of parsing the Base64 response to avoid encoding issues.
Expected behavior
The screenshot should render the gallery images completely.
Actual behavior
The page layout, fonts, and background colors load perfectly, but all the gallery images (.webp formats) render as native broken image icons.
My environment:
Questions:
Thanks in advance for the help!
Beta Was this translation helpful? Give feedback.
All reactions