콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
19059 화면

I'm trying to put an image sotred in my custom module in /static/src/img/ and i found that the supossed correct way is with <img class="img img-responsive" src="/my_module/static/src/img/my_image.png"/>

But the image is not showing at all, i also tried with the absolute path but still not working, this is the part of the template im working on:

<img t-if="obj.company_id.extra_logo"
class="img" style="max-width: 40mm; max-height: 20mm;"
t-att-src="'data:image/png;base64,%s' % obj.company_id.extra_logo"/>
<img t-if="not obj.company_id.extra_logo"
class="img" style="max-width: 40mm; max-height: 20mm;"
src="/extra_reports/static/src/img/default_logo.png"/>

** I tried without the t-if condition for the second image, but in any case a small square is showed, representing the image without the image itself.

What i'm doing wrong?


아바타
취소
베스트 답변

Hello 

try below code,

<t t-if="obj.company_id.extra_logo">
<img t-att-src="'data:image/png;base64,%s' % to_text(obj.company_id.extra_logo)" style="max-height:1cm; max-width:4cm;"/>
</t>
아바타
취소
베스트 답변

Hello

You can try below code i think it's help you

<img t-if="obj.company_id.extra_logo"
t-att-src="'data:image/png;base64,%s' % obj.company_id.extra_logo"
style="max-width: 40px; max-height: 20px;"/>
아바타
취소
베스트 답변

hey try this

store your image in web/static/src/img

<img src="http://localhost:8069/web/static/src/img/your_logo.jpg" width="180" height="150" />

you can also try this

<img t-attf-src="data:image/*;base64,{{company.logo}}" t-att-alt="company.name" style="max-height: 100px;"/> 



아바타
취소
관련 게시물 답글 화면 활동
2
8월 20
4116
1
1월 19
8731
0
12월 24
1246
0
12월 24
1069
2
7월 24
2992