add function resize depending on width and height