not the answer to your question but why not use getimagesize('/path/to/image') ? it works with or without GD support.
as for image magick , if it works in the terminal it should work via the browser , but if you are getting path related errors (apache/your host may be doing some path translation) try redirecting errors back to PHP and see if they tell you anything .....
exec ($identify_cmd . ' 2>&1 ', $exec_output);