added automatic resizing images before uploading to the server