add image resize logic