Welcome to the forum, feel free to ask questions here.
string $camera = ""; string $panel = `getPanel -wf`; if (`getPanel -to $panel` == "modelPanel") $camera = `modelEditor -q -camera $panel`; int $isResGateEnabled = `camera -q -displayResolution $camera`; float $ratio = 1.0; if ($isResGateEnabled) $ratio = 1.0; else $ratio = 1.3; camera -e -displayResolution (!$isResGateEnabled) -overscan $ratio $camera;