Updated code for better functionality (made it easier to change size of image sent).