'Register an image file as a project avatar.
The avatar created is temporary and must be confirmed before it can
be used.
Avatar images are specified by a filename, size, and file object. By default, the client will attempt to
autodetect the picture\'s content type: this mechanism relies on libmagic and will not work out of the box
on Windows systems (see http://filemagic.readthedocs.org/en/latest/guide.html for details on how to install
support). The ``contentType`` argument can be used to explicitly set the value (note that JIRA will reject any
type other than the well-known ones for images, e.g. ``image/jpg``, ``image/png``, etc.)
This method returns a dict of properties that can be used to crop a subarea of a larger image for use. This
dict should be saved and passed to :py:meth:`confirm_project_avatar` to finish the avatar creation process. If
you want to cut out the middleman and confirm the avatar with JIRA\'s default cropping, pass the \'auto_confirm\'
argument with a truthy value and :py:meth:`confirm_project_avatar` will be called for you before this method
returns.
:param project: ID or key of the project to create the avatar in
:param filename: name of the avatar file
:param size: size of the avatar file
:param avatar_img: file-like object holding the avatar
:param contentType: explicit specification for the avatar image\'s content-type
:param boolean auto_confirm: whether to automatically confirm the temporary avatar by calling
:py:meth:`confirm_project_avatar` with the return value of this method.'

@translate_resource_args
def create_temp_project_avatar(self, project, filename, size, avatar_img, contentType=None, auto_confirm=False):

    size_from_file = os.path.getsize(filename)
    if (size != size_from_file):
        size = size_from_file
    params = {u'filename': filename, u'size': size}
    headers = {u'X-Atlassian-Token': u'no-check'}
    if (contentType is not None):
        headers[u'content-type'] = contentType
    else:
        headers[u'content-type'] = self._get_mime_type(avatar_img)
    url = self._get_url(((u'project/' + project) + u'/avatar/temporary'))
    r = self._session.post(url, params=params, headers=headers, data=avatar_img)
    cropping_properties = json_loads(r)
    if auto_confirm:
        return self.confirm_project_avatar(project, cropping_properties)
    else:
        return cropping_properties
