background gallery grid view fix for PHP 5.4