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");
}
}}
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.
![]()
$.value.description will return null at least 1 time, that null will not be handled by string.contains(), an exception is fired instead.
Workaround: concat with void string
$.value.description..''
A proper bug report should be issued against string.contains() eventually. edited 16:25, 16 Mar 2009