Upload image and prepare image functions