In your block layer I imagine you have some sort of code like this:
PHP Code:
function onActionServerSide() {
if (params[0] == "createblock") {
temp.block = putnpc2(params[1], params[2], "");
temp.block.headblock = player.head;
temp.block.join("your_block_class");
}
}
Then in your class you can use this.headblock as your image name.