fix image upload issue, add gallery function