OpenERP Picture Path processing

Source: Internet
Author: User

OpenERP currently stores images such as human resources Avatar pictures are stored in a binary way in the database, to modify the database only the storage path can be used in this way

Image Adorner:

Image adorner contains 3 picture display

Image big picture

Pictures in Image_medium

Image_small Small picture

We see in the OpenERP source code there is a two method _get_image, _set_image, here we need to rewrite the two methods

def_get_image (Self, CR, UID, IDS, name, args, context=None)://other omitted Fr=file (' Apath ','RB')   //At this point the file is in a folder on the hard disk, Apath is the file path Result[obj.id]=tools.image_get_resized_images (Base64.b64encode (Fr.read ()))//Be sure if Base64 data fr.close ()returnresultdef_set_image (Self, CR, UID, ID, name, value, args, context=None):#eg file path is named Apath//file write to hard disk Apath path omitted, write yourselfreturnSelf.write (cr,uid,[id],{'ImagePath': Apath},context=context)

OpenERP Picture Path processing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.