extjs - Wrap a database stored image inside an Ext.Img component -
so have images stored in database. kept blobs, not path physical location. can access them via: http://example.com/data/pagemedia?id=%someid%
.
but when want wrap image in ext.img:
ext.create('ext.img', { src: 'http://example.com/data/pagemedia?id=' + someid, renderto: ext.getbody() });
it doesn't render image.
it works fine pure html, though:
<img src="http://example.com/data/pagemedia?id=%someid%"/>
should use ajax request or else , set src
dynamically?
here working example:
ext.create('ext.img',{ src : 'gallery/getimage/' + imageid, renderto: 'cat-img' // in case ext.getbody() });
notice how create image url. if someid js variable , not hardcoded, have write:
ext.create('ext.img',{ src : 'http://mysite.com/data/pagemedia?id='+someid, renderto: ext.getbody() });
Comments
Post a Comment