Fixed Undeclared variable issues

Changed $resize to $source and decalred $resized to address undeclared variables