I am using the following code to dynamically generate a background image:
$image = imagecreatefromjpeg( 'FILENAME' );
header( 'Content-Type: image/jpeg' );
imagejpeg( $image );
Opera displays nothing when I try to view this script. Chrome and IE work fine, and if I add header( 'Content-Disposition: attachment; filename=download.jpg' );
Opera will download the image as expected (and the content is correct).
Is there a workaround for this, or some header that I am not setting? I am surprised that Chrome handles the image correctly, while Opera (Chromium-based) does not.
Update: the same problem is true if I use, e.g., Content-Type: image/png
and imagepng()
instead: loads in all browsers but Opera, and Opera downloads the file correctly.
Update': this is an extension problem, but I don't know why. Adding my site to the whitelist of uBlock makes everything work. My site has practically zero traffic and certainly doesn't spam anything, so this is odd.