[PHP GD Library] Images Not Showing For Some Site Users

Hi there,

I run a virtual pet website and we use the PHP GD Library to produce our Avatars and Pets. We have over a thousand users so far, and out of that only 3 users have had this issue. For each user though, it’s the exact same issue.

Here is a screenshot of what these users see:


The majority of the images just show the “Broken Link” icon, but every once in awhile it starts to build the image and stops before finishing.

These are my attempts at fixing it:

Removed everything from the code other than taking an image and printing it out.
Placed the code on an entirely different Server by a different Host
Removed the Site from Cloudflare DNS servers to see if Cloudflare was causing it
Used JPEG images instead of PNGs
This is the information I have gathered thus far from these users:

Viewing our site through a proxy allows the images to load
Using a laptop from the same internet connection loaded the images successfully
Browsers either just output the broken link or say that the image contains errors and cannot be displayed.
And lastly, here is the code of the simple test image page I am using:

$finalimage = imagecreatetruecolor(500,500);
$file = 'http://www.somesite.com/picture.jpg';
$layers = imagecreatefromjpeg($file);
imagecopy($finalimage, $layers, 0, 0, 0, 0, 500, 500);

header("Content-type: image/jpeg");

If anyone has any ideas at all it’d be greatly appreciated, I am stuck as what to do at this point. :frowning: