koen
October 9, 2017, 4:54pm
1
Hi,
i’m having trouble placing a base64 logo in a div with a fixed width an height.
I managed to get the width set to 200px but the height isn’t possible.
and no, it’s not simply setting the height to 200 px.
it’s importent that the logo keeps it’s proportions.
here’s the code:
<table id=“table_base64” class=“table-no-style” data-column-resize=“” cellpadding=“0” anchor=“page_media_0”
cellspacing=“0”
style=“width: 35mm; position: absolute; top: -257.6333748046875px; left: 465.3493297729492px; height: 67px;” offset-x=“563.616” offset-y=“25.83330000000001”>
<tbody>
<tr>
<td style=“width: 100%; font-size: 10pt; vertical-align: bottom;”>
<img id=“b64img” src=“data:image/png;base64,” width=“200px” style=“width: 100%;”>
</td>
</tr>
</tbody>
</table>
Erik
October 10, 2017, 6:22am
2
You could assign the max-width and max-height properties. The following should work:
<img id="b64img" src="data:image/png;base64," style="max-height: 48px; max-width: 48px;"">
Alternatively you could set the base64 encoded image as background image for the respective table cell via CSS. There are some powerful properties for background images like background-size which can be set to a length or special value like contain and cover (very convenient when the image needs to adapt to the size of the container). See the sample below.
Erik
#your-table-cell {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2hpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1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