updated img function to pass unit to width and height when rendering