Made the image aspect ratio logic consistent for desktop and mobile