building some image uploading functions