MindTouch Developer Center > DekiScript > Samples/FAQ > How do I... Embed image depending on the description?
Redirected from DekiScript/FAQ/Embed image depending on the description?

How do I... Embed image depending on the description?

Table of contents
  1. 1. sample output

Good for when you just want to change a user's profile image without changing the markup/code.
You just use the image's description for filtering.

{{
var photoList = map.select(page.files, "string.contains($.value.description, 'photo')");
if (#photoList > 0) {
  var photoFile = map.values(photoList)[0];
  web.image(photoFile.uri, 187, 187, photoFile.description);
 }
else {
  web.html("no photo");
 }
}}

sample output

If you want to change the image to another(better) one.  Just attach it and change it's description to "profile photo"You also need to remove the same description to the previous image.

profile photo

Tag page
You must login to post a comment.
Powered by MindTouch Deki v.8.08.2