add return type for returnImage
Revert "remove some variables from build method".  Fixes broken in PHP 5.3

This reverts commit 36aefbf26a12bb10cad3ac9a36e9348ee3181d5b.
remove redundant $n variable in build method
whitespace changes
add test to check returnImage method returns a resource