javascript - Meteor displaying base64 image in HTML -


i creating meteor app users ask , anwser questions. using text editor user input. allows user insert images , inserts them in database in base64 format. question is there way display them in html helpers. code now: posts:

function(){         var posts = posts.find({});         var postsarray = [];         posts.foreach(function(entry){             var object = new object();             object.title = entry.title;             object.image = entry.content.match(/src=(.*?)style/)[1];             console.log(object);             postsarray.push(object);         })         return postsarray;      },// returns posts 

html:

{{#each posts}}          <h3>{{title}}</h3><br/>         <img src={{image}}/>      {{/each}} 

actually, found answer. mistake in regular expression:

posts:function(){         var posts = posts.find({});         var postsarray = [];         posts.foreach(function(entry){             var regex = /<img.*?src='(.*?)'/;             var object = new object();             object.title = entry.title;             object.image = entry.content.match(/<img src="(.*?)"/)[1];             console.log(object);             postsarray.push(object);         })         return postsarray;      },// returns posts 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -