Added in on-the-fly image resizing and storage for optimization.