Im not exsactly sure what kind of output does identify but if it outputing content on diferent line could use explode("\n",$outputOfExec); and then echo the first line by echo $explodedContent[0];
$output = exec('identify -format "%W" $img_temp', $out);
$array = explode("\n",$output);
echo $array[0];