Added image resizing to JS functions