Local storage and imageAPI function