Something has changed somewhere. I have returned to the random code you mentioned above to put in as a hook which worked at the time. I have latest upgrades of GP and GPP and WP.
The random images works fine, but it is printing out the php code to the screen.
See here Link