Permalink
Browse files

🚑 forgot to delete when merge

  • Loading branch information...
RafiZz committed Nov 22, 2018
1 parent 7f16ab8 commit 3e1a7375f8bdd763365e6c9b6169d46aade5324e
Showing with 0 additions and 47 deletions.
  1. +0 −1 ir_attachment_s3/__manifest__.py
  2. +0 −46 ir_attachment_url/models/image.py
@@ -18,7 +18,6 @@
],
"external_dependencies": {"python": ['boto3'], "bin": []},
"data": [
"views/ir_attachment_s3.xml",
"security/ir.model.access.csv",
"views/res_config_settings_views.xml",
],
@@ -77,52 +77,6 @@ def updated_image_get_resized_images(base64_source, return_big=False, return_med
return return_dict


super_image_resize_image = tools.image_resize_image


def updated_image_resize_image(base64_source, size=(1024, 1024), encoding='base64', filetype=None, avoid_if_small=False):
if is_url(base64_source):
return base64_source
return super_image_resize_image(base64_source, size=size, encoding=encoding, filetype=filetype, avoid_if_small=avoid_if_small)


def updated_image_resize_image_big(base64_source, size=(1024, 1024), encoding='base64', filetype=None, avoid_if_small=True):
""" copy-pasted from odoo/tools/image.py::image_resize_image_big
because we rewrite image_resize_image function.
"""
return updated_image_resize_image(base64_source, size, encoding, filetype, avoid_if_small)


def updated_image_resize_image_medium(base64_source, size=(128, 128), encoding='base64', filetype=None, avoid_if_small=False):
""" copy-pasted from odoo/tools/image.py::image_resize_image_medium
because we rewrite image_resize_image function.
"""
return updated_image_resize_image(base64_source, size, encoding, filetype, avoid_if_small)


def updated_image_resize_image_small(base64_source, size=(64, 64), encoding='base64', filetype=None, avoid_if_small=False):
""" copy-pasted from odoo/tools/image.py::image_resize_image_small
because we rewrite image_resize_image function.
"""
return updated_image_resize_image(base64_source, size, encoding, filetype, avoid_if_small)


def updated_image_get_resized_images(base64_source, return_big=False, return_medium=True, return_small=True,
big_name='image', medium_name='image_medium', small_name='image_small',
avoid_resize_big=True, avoid_resize_medium=False, avoid_resize_small=False):
""" copy-pasted from odoo/tools/image.py::image_get_resized_images
because we rewrite image_resize_image function.
"""
return_dict = dict()
if return_big:
return_dict[big_name] = updated_image_resize_image_big(base64_source, avoid_if_small=avoid_resize_big)
if return_medium:
return_dict[medium_name] = updated_image_resize_image_medium(base64_source, avoid_if_small=avoid_resize_medium)
if return_small:
return_dict[small_name] = updated_image_resize_image_small(base64_source, avoid_if_small=avoid_resize_small)
return return_dict


tools.image_resize_images = updated_image_resize_images
tools.image_resize_image = updated_image_resize_image
tools.image_resize_image_big = updated_image_resize_image_big

0 comments on commit 3e1a737

Please sign in to comment.