The Linux Page

Wordpress extension for Facebook graph loads partial image and White Screen of Death as a result!

Today I tested one of my Stargazer Rock blog pages and got a WSoD... Not the first time, but last time I fixed the problem by loading and resaving a PNG and changing an SVG to a PNG. Not the type of things I really want to do while bloging.

So I search into it, there is a plugin I use, called "Facebook Open Graph, Google+ and Twitter Card Tags" which attempts to load an image but only the first 32Kb. If that loads fine, then the author attempts to get the image dimensions and save that to the open graph meta data.

Somehow, some images will actually break that process because the image information ends up after the first 32Kb. So the image loads partially. The ImageMagick library is okay opening the file, but once we try to get data such as the width and height, it breaks SILENTLY. Because the author used the @ in front of many of the graphical library functions and as a result we get zero feedback and worst than that, somehow we get a White Screen of Death.

By removing the partial load capability I was able to get my page to display as expected.

The following is the part of the code that I edited.

As we can see, instead of setting that "Range: ..." string in the $headers variable, I just use null and that means it works at least (I would be okay with missing the width and height in the OpenGraph meta data, but a WSOD is not likely to be a good solution with that one.)

File to Edit:

wp-content/plugins/wonderm00ns-simple-facebook-open-graph-tags/public/class-webdados-fb-open-graph-public.php

//We'll get just a part of the image to speed things up. From http://stackoverflow.com/questions/4635936/super-fast
$headers = null;
//array(
//      "Range: bytes=0-32768"
//);
$data = $this->get_open_graph_image_size_curl($image, $headers);

Now I can load that page.

Note that I had TWO images that generated that problem. There is one of them:

Telescope de Lassel, picture published in La Nature in 1873

It's sad that it would fail like that in the middle of it. Oh well...

See Bug Report