calculate width and height conditionally based on content_type