gLastFM empty cover fix

gLastFM empty cover fix

gLastFM is (imho) one of the few working Last.fm widgets for WordPress. Especially it features the easy usage of an own widget template to integrate better in the used wordpress theme. Unfortunately it’s last version was released on the last day in 2011. Except for one little bug it works still great in current WordPress 3.5.1, and this bug is not related to WordPress.

If Last.fm does not have a cover image for the shown track, gLastFM throws some PHP errors about not set variables. But that is easy to fix. You only have to insert the followin lines into glastfm.widget.php around line 307, to set the default empty image for the size specific variables.

$picurl = GLASTFM_PLUGIN_URL . 'theme/empty_' . $image_size . '.png';
$picurl_small		= GLASTFM_PLUGIN_URL . 'theme/empty_0.png';
$picurl_medium		= GLASTFM_PLUGIN_URL . 'theme/empty_1.png';
$picurl_large		= GLASTFM_PLUGIN_URL . 'theme/empty_2.png';
$picurl_extralarge	= GLASTFM_PLUGIN_URL . 'theme/empty_3.png';