在資產模塊我們有'asset.asset'字段那裏我有'image_medium'。所以我想把它做得更大。以下我已經做了這個領域更大的128px * 128px但是在保存了它的模糊之後,我的意思是我想讓它在更高的像素上。如何讓圖像場更大?
1
A
回答
0
與此
<field name="image" widget="image" class="oe_right oe_image_custom" style="width: 265px; height: 300px;"/>
0
嘗試這是示例圖像小型,中型和標誌型的
_columns = {
'brand_id': fields.many2one('model.name', 'Make', required=True),
'image': fields.related('brand_id', 'image', type="binary", string="Logo"),
'image_medium': fields.related('brand_id', 'image_medium', type="binary", string="Logo (medium)"),
'image_small': fields.related('brand_id', 'image_small', type="binary", string="Logo (small)"),
}
以及新的API,你可以做下面的代碼:
# image: all image fields are base64 encoded and PIL-supported
image = openerp.fields.Binary("Photo", attachment=True,
help="This field holds the image used as photo for the employee, limited to 1024x1024px.")
image_medium = openerp.fields.Binary("Medium-sized photo",
compute='_compute_images', inverse='_inverse_image_medium', store=True, attachment=True,
help="Medium-sized photo of the employee. It is automatically "\
"resized as a 128x128px image, with aspect ratio preserved. "\
"Use this field in form views or some kanban views.")
image_small = openerp.fields.Binary("Small-sized photo",
compute='_compute_images', inverse='_inverse_image_small', store=True, attachment=True,
help="Small-sized photo of the employee. It is automatically "\
"resized as a 64x64px image, with aspect ratio preserved. "\
"Use this field anywhere a small image is required.")
@api.depends('image')
def _compute_images(self):
for rec in self:
rec.image_medium = tools.image_resize_image_medium(rec.image)
rec.image_small = tools.image_resize_image_small(rec.image)
def _inverse_image_medium(self):
for rec in self:
rec.image = tools.image_resize_image_big(rec.image_medium)
def _inverse_image_small(self):
for rec in self:
rec.image = tools.image_resize_image_big(rec.image_small)
def _get_default_image(self, cr, uid, context=None):
image_path = get_module_resource('hr', 'static/src/img', 'default_image.png')
return tools.image_resize_image_big(open(image_path, 'rb').read().encode('base64'))
1
在xml視圖中將字段名稱'image_medium'
更改爲image
。
刪除類oe_avatar
並添加height="300" width="300"
,它應該工作。
+0
是的,做完了,謝謝你 –
相關問題
- 1. 如何讓標籤圖像更大?
- 2. 如何讓鼠標懸停在使用Angular.js圖像更大
- 3. 如何讓這個大的圖像與更小的圖像並排?
- 4. 如何讓谷歌地圖市場,像動態方塊
- 5. 如何讓3D div更大?
- 6. 如何讓圖像在放大UIScrollView時無法調整大小?
- 7. fancybox - 當點擊圖像(大拇指)如何讓FancyBox加載更大的圖像/不同的URL
- 8. 如何更改圖像的大小
- 9. 如何更改圖像的大小?
- 10. 如何更改qrencode.encode的圖像大小?
- 11. 如何更改圖像的大小?
- 12. 如何防止更改圖像大小?
- 13. 如何更改drawableTop圖像大小
- 14. 如何更改UIBarButtonItem圖像大小
- 15. 如何添加邊界到廣場大圖像?
- 16. 如何讓圖像互動?
- 17. 如何讓圖像淡出?
- 18. 如何讓圖像在asp.net
- 19. 如何讓圖像響應?
- 20. 如何能夠讓圖像
- 21. 如何讓Highcharts放大圖像內容而不是添加更多細節?
- 22. 如何讓一個更大的頭像(圖片)在twitter引導navbar
- 23. 如何更改場景生成器中的場景大小?
- 24. 如何讓jQuery以字節獲取圖像大小,而不是圖像尺寸?
- 25. 如何讓圖像滑出視圖?
- 26. 如何讓圖像(不同大小)與文本內嵌?
- 27. 如何讓圖像在UIWebView中調整大小?
- 28. 如何讓表格單元適合包含圖像的大小?
- 29. 如何讓圖像按照窗口大小的比例顯示?
- 30. 如何讓java運行時相當大的圖像框
k我應該在.py字段文件中添加 –
image = fields。? –
使用fields.binary – user00000341