Troubleshooting · Developer docs

Troubleshooting

Grouped by symptom, never by module, because the person with the problem does not know which module has it. One hundred questions across ten pages, each answered with the causes in the order they usually turn out to be true.

Symptom 8 questions

Images

Eight image symptoms on live sites, from the grey placeholder to the slow first visitor, each traced to a setting or a call and its fix.

Images are transformed on first request and cached, rendered through one object, and shaped by a handful of site settings. Nearly every symptom here is one of those three.

A grey placeholder box appears on production

The template uses getAreaImageOrPlaceholder() and the setting Show image placeholders is at its default, For logged in users, which includes site members. On a membership site set it to Never, or use getAreaImage() with an isBlank() check in templates members see.

Open this answer on its own page →
My image came out as a picture tag with sources I did not ask for

The site setting Generate picture tag is on. Every image rendered through getHtml(), and every image in rich text, becomes a <picture> with a WebP source, an original-format source and an <img> fallback, plus 2x versions when the image was resized and the original is large enough. Your attributes are on the inner <img>. Inside a hand-written picture element use getPath(), not getHtml().

Open this answer on its own page →
A WebP version is being served to a browser that cannot display it

A converted path was put into a plain <img src> or a CSS background, where there is no negotiation. Render through getHtml() with picture tags on, so the browser chooses by type, or keep the original format for a plain src. Note that when no image service can produce the WebP, the original file is delivered under the .webp URL, which browsers accept; so check the response before blaming the browser.

Open this answer on its own page →
A resized image is blurry or the wrong crop

The strategy: fit crops to fill the box, auto scales to fit inside it, exact and square stretch, portrait currently errors and should be auto with only a height. Blur is an original smaller than the requested size, or a 1x image on a high-density screen without the 2x source, which is only offered when picture tags are on, the image was resized in the template and the original is at least one and a half times the requested size. Compression quality is a setting, judged on real images with the URL parameters l and q.

Open this answer on its own page →
An inline width style disappeared from the rendered image tag

By design: a pixel width or height in a style passed to getHtml() is taken out of the style, used to resize the image, and emitted as width and height attributes, so a 3000-pixel file is not downloaded to show at 300. Values in other units stay in the style. Resize explicitly with getResized() and style the element with a class.

Open this answer on its own page →
The first visitor to a page waits noticeably longer than the second

Every resized or converted version is generated on its first request and cached, and the page itself is cached for anonymous visitors after its first render. A deploy or a cache purge resets both. Expect it, and warm the key pages after a deploy by requesting them; keep the set of sizes small so there are fewer versions to generate; and put the same call order (resize, then convert) in every template, or the cache holds every image twice.

Open this answer on its own page →
An image URL with resize parameters returns the original size

The requested size equals the original, so nothing is resized. Then: the resize request is invalid (fit with one dimension, an unknown strategy), and on an image straight from a layout area the platform logs it and returns the full-size original; the filename is of type file, which cannot be transformed; no w or h parameter is present; or no image service could do the work and the original was delivered. Check the resize arguments first.

Open this answer on its own page →
Images from the old site did not come across during migration

Import external images is off by default, and it acts on save: migrated rich text that was never re-saved with the setting on keeps hotlinking the old site. Turn it on, re-save the records (in the admin or through the API), check the file manager, and turn it off again. Two sites that had a file at the same path share one copy, so check logos and other common paths after the import.

Open this answer on its own page →
Go deeper

Was this page helpful?

Your answer goes to the docs team.