Check imagecreate*() return before using and use logger in \OC_Image

followup of https://github.com/owncloud/core/pull/11096