Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Resize Image not square for print it in a report

By
Selverine
on 2/12/15, 12:58 PM 953 views

Hello,

I am trying to put some picture on report.

The objectif is that users choose a picture ( size and shape what they wants) and when they print the report, the picture is inside the report.

I tried with the image_resize_image.

I have a problem: Or the picture is to big, or when I use the image_resize, it is cut me part of the picture ( I use picture that are not square).

Someone has another idea?

 

This is my code:

 

from openerp.tools import image_resize_image

        'image':fields.binary("Picture",
            help="This field holds the image used as avatar for this contact, limited to 1024x1024px"),

        'image_medium': fields.function(_get_image, fnct_inv=_set_image,
            string="Medium-sized image", type="binary", multi="_get_image",
            store={
                'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
            },
            help="Medium-sized image of the product. It is automatically "\
                 "resized as a 128x128px image, with aspect ratio preserved, "\
                 "only when the image exceeds one of those sizes. Use this field in form views or some kanban views."),

        'image_small': fields.function(_get_image, fnct_inv=_set_image,
            string="Small-sized image", type="binary", multi="_get_image",
            store={
                'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
            },
            help="Small-sized image of the product. It is automatically "\
                 "resized as a 64x64px image, with aspect ratio preserved. "\
                 "Use this field anywhere a small image is required."),

 

Thank you a lot,

 

Selverine

Maybe it exist another function like image_resize_image but that resize and keep the shape of the picture?

Selverine
on 2/15/15, 10:10 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/12/15, 12:58 PM
Seen: 953 times
Last updated: 3/16/15, 8:10 AM