* Graham
This javascript and filelist script utility will only work on HTML5 browsers able to handle dynamic content and the canvas element

It converts image files into base64 data uri's.

When the image is clicked the base64 data uri will appear in the textarea
This can then be used in the 'src' parameter of the img tag
Note: base64 data uri's take about 33% more space than a normal image but means the images can be embedded directly into code or css
Animated images will be static when converted
WARNING this script is only really for small images trying to convert large images will cause your browser to lockup for several seconds or even run out of memory
It is run on the browser NOT xtgems servers
  function getDataUri(url, callback) {
    var image = new Image();
    image.onload = function () {
      var canvas = document.createElement('canvas');
      canvas.width = this.naturalWidth;
      canvas.height = this.naturalHeight;
      canvas.getContext('2d').drawImage(this, 0, 0);
    image.src = url;
  function b64(img){
    getDataUri(img, function(dataUri) {
  <div class="xt_container">
    <xt:filelist folder="/images" template="&lt;img src=&quot;.file_url.&quot; alt=&quot;*&quot; onclick=&quot;b64(this.src)&quot; /&gt;&lt;br /&gt;" per_page="10"/>
    <textarea id="output" style="display:block;margin:0 auto; width:98%;height:20em"></textarea>

Copy code
2016-07-05 10:25 (edited 2016-07-05 23:32 by Graham ) · (2)
* Graham
If you are using a PC or laptop
There is a javascript bookmark that will convert almost any image on the web into base64 data

You just open the image in it's own page and click the bookmark
get it from here http://jsfiddle.net/bgmort/m26yr/
2016-07-06 22:12 (edited 2016-07-06 22:23 by Graham ) · (0)

Online: Guests: 1