Change frame size based on content