I have base64 string image in my database table. I want to load the image from database into my multi-channel app. How do i bind them, direct call the string from database? Thanks a lot.
For now i have this code.
HTML
<div data-options="dxView : { name: 'tb_proj_gallery', title: 'tb_proj_gallery', targetFrame: 'navigation' } " >
<div data-options="dxContent : { targetPlaceholder: 'content' } " >
<div class="gallery" data-bind="dxGallery: { width: '100%', height: '100%', dataSource: dataSource, showNavButtons: true }">
<div data-options="dxTemplate : { name: 'item' } " >
<div class="gallery-item">
<img data-bind="attr: { src: 'data:image/jpeg;base64,' + file_name }" />
</div>
</div>
</div>
</div>
JS
KioskAppV2.tb_proj_gallery = function(params) {
"use strict";
var shouldReload = false,
dataSource;
function handletb_proj_galleryModification() {
shouldReload = true;
}
function handleViewShown() {
if(shouldReload) {
shouldReload = false;
dataSource.load();
}
}
dataSource = new DevExpress.data.DataSource({
store: KioskAppV2.db.tb_proj_gallery,
map: function(item) {
return new KioskAppV2.tb_proj_galleryViewModel(item);
}
});
return {
dataSource: dataSource,
viewShown: handleViewShown
};
};
The file_name is the column name in tb_proj_gallery table where the image base64 string is save. This code return gallery view with same number of image in the table but the image didnt appear. Its broken. How to make it appear? TQ.