I remember doing this a while back for some project But the way I did approach this was
When the call is first made to get the image, check if in the cache directory (a directory of your choice) the image exists (read ahead to find out how to relate the images), if it exits then load it, else download the image and save the image name as perhaps a hash of the data that the image represents, or something that can represent a valid key for the data without getting a collision.
For example,
Thumbnail 1 - String 1
Thumbnail 2 - String 2
I save thumbnail 1 as a hash of string 1, then the next time i encounter this string 1, i check in the cache directory if the image exists that represents this, and i simply load it, else i download it, save it and etc like i said before :)