I have images of a certain image style that only show up after reloading the page. I can see the image created in the style directory after the first page request. Its like the browser is not waiting for the image to be created.
I wrote a curl script to request all the images of that style on the site, which works. But I'm worried that when new images are added they won't show on first request. Any idea what would cause that?
UPDATE:
I spent most of the day yesterday working on this. It happens when the derivative image is first created and served by Drupal. I found an extra new line character at the beginning of the image. If I save it to my desktop and remove the newline it works fine.
I read elsewhere that this can be caused by an extra space in a file like settings.php or template.php, usually before the <?php
or after the ?>
if it has one. I checked and rechecked those files and I've also been using find
and grep
to try and find the offending file but so far no luck.
I also tried adding header("Fake: fake");
to different files to see if I could generate a "headers already sent" error. But the output buffering Drupal uses seems to prevent that from working. Also I added $conf['image_allow_insecure_derivatives'] = TRUE;` to settings.php but that didn't fix it either.