To get small image in product module first inherit the product.product object in product module and add one fields like image_small and write the fucntion _get_image in your own module in openerp.
for example you can use the below fucntion in .py file,
def _get_image(self, cr, uid, ids, prop, unknow_none, context=None):
result = {}
for obj in self.browse(cr, uid, ids, context=context):
if not obj.product_image:
result[obj.id] = False
continue
image_stream = io.BytesIO(obj.product_image.decode('base64'))
img = Image.open(image_stream)
img.thumbnail((120, 100), Image.ANTIALIAS)
img_stream = StringIO.StringIO()
img.save(img_stream, "JPEG")
result[obj.id] = img_stream.getvalue().encode('base64')
return result
0 Comment(s)