Move the helper function to JMediaHelper

and use follow the official Joomla coding standards as suggested in
joomla/joomla-cms#3592.
As the transition from the component helper to JMediaHelper is currently
in the works, the function is added to MediaHelper as well.