add image scaling code