Fixing the Blank Image Bug in WordPress

A recent update to this site brought a nasty bug: social networks displayed a blank image next to posts not containing any image. It was a bit tedious to manually remove them (and they can’t be removed in Flipboard).

The bug was introduced when I updated the JetPack plugin from 2.5 (if memory serves) to the latest 2.7. In a rather stupid move this version puts an og:image Open Graph tag pointing to a blank image if the post doesn’t contain one. Digging around the ‘net showed that this issue was present in 2.6 and that the folks at JetPack think that it’s good this way. Well… Leaving the offending tag’s removal the only possible way to fix it.

Fortunately this is pretty simple: add the following code to the end of the theme’s functions.php file. It will remove the og:image tag when JetPack sets the default blank image.

The code snippet fixes another issue: JetPack sets the twitter:site¬†tag to their own Twitter account – another no-no. Just don’t forget to replace my Twitter with yours ūüôā

function fix_jp_og_bugs ($og_tags)
{
    $og_tags['twitter:site'] = '@laszlop';

    if  (0 == strcmp ($og_tags['og:image'],
        "http://wordpress.com/i/blank.jpg")
    {
        unset ($og_tags['og:image']);
    }

    return $og_tags;
}

add_filter ('jetpack_open_graph_tags', 'fix_jp_og_bugs', 11);

30-bit Color Depth on the Mac

This morning I was trying to find information about 30-bit (10 bits per component) color depth support on Macs. As you might guess, I found nothing usable. Although high-end graphics cards from both AMD and NVIDIA support the OpenGL extension for 10 bpc color, Apple does not advertise their machines as such.

So I ended up creating a little tool for assessing 10 bpc color capability. The following code tries to create a window with 10 bpc and queries the result (this code is highly similar to those found in AMD’s and NVIDIA’s 10 bpc guides).

#include <stdio.h>
#include <GLUT/GLUT.h>

int main (int argc, char *argv[])
{
    glutInit (&argc, argv);

    //
    // Request a 10-bit per component bit depth and create
    // the window.
    //

    glutInitDisplayString ("red=10 green=10 blue=10 alpha=2");
    glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    int window = glutCreateWindow ("bitdepth");

    //
    // Check how many bits we have.
    //

    GLint red, green, blue;
    glGetIntegerv (GL_RED_BITS, &red);
    glGetIntegerv (GL_GREEN_BITS, &green);
    glGetIntegerv (GL_BLUE_BITS, &blue);

    //
    // Clean up and show results.
    //

    glutDestroyWindow (window);

    printf ("Bit depth is %d/%d/%d\n", red, green, blue);

    return 0;
}

You should link with the OpenGL and GLUT frameworks.

Or you can grab the compiled executable here. It runs on 10.5 and up. Just run it and it will display the assessment result:

Bit depth is 8/8/8

I currently have no access to newer Mac Pros, which I suspect to have 30-bit support. So if you have and got 10/10/10, please let us know in the comments!