src/js/misc.js
function image(ph, fireErr) {
    if (arguments.length < 2) {
        fireErr = false;
    }
    var doit   = new DoIt(),
        jn     = doit.join(),
        marker = "data:image";

    if (isString(ph) && ph.length > marker.length) {
        // use "for" instead of "indexOf === 0"
        var i = 0;
        for(; i < marker.length && marker[i] === ph[i]; i++) {}

        if (i < marker.length) {
            var file = ZFS.read(ph);
            if (file !== null) {
                ph = "data:image/" + file.ext +  ";base64," + file.data;
            }
        }
    }

    $zenv.loadImage(ph,
        function(img) {
            jn(img);
        },
        function(img, e) {
            if (fireErr === true) {
                doit.error(e);
            } else {
                jn(img);
            }
        }
    );
    return doit;
}
function image(ph, fireErr) {
    if (arguments.length < 2) {
        fireErr = false;
    }
    var doit   = new DoIt(),
        jn     = doit.join(),
        marker = "data:image";

    if (isString(ph) && ph.length > marker.length) {
        // use "for" instead of "indexOf === 0"
        var i = 0;
        for(; i < marker.length && marker[i] === ph[i]; i++) {}

        if (i < marker.length) {
            var file = ZFS.read(ph);
            if (file !== null) {
                ph = "data:image/" + file.ext +  ";base64," + file.data;
            }
        }
    }

    $zenv.loadImage(ph,
        function(img) {
            jn(img);
        },
        function(img, e) {
            if (fireErr === true) {
                doit.error(e);
            } else {
                jn(img);
            }
        }
    );
    return doit;
}
function image ( ph , fireErr ) { if ( arguments . length < 2 ) { fireErr = false ; } var doit = new DoIt ( ) , jn = doit . join ( ) , marker = "data:image" ; if ( isString ( ph ) && ph . length > marker . length ) { // use "for" instead of "indexOf === 0" var i = 0 ; for ( ; i < marker . length && marker [ i ] === ph [ i ] ; i ++ ) { } if ( i < marker . length ) { var file = ZFS . read ( ph ) ; if ( file !== null ) { ph = "data:image/" + file . ext + ";base64," + file . data ; } } } $zenv . loadImage ( ph , function ( img ) { jn ( img ) ; } , function ( img , e ) { if ( fireErr === true ) { doit . error ( e ) ; } else { jn ( img ) ; } } ) ; return doit ; }
Load image or complete the given image loading.
@param  {String|Image} ph path or image to complete loading.
@param  {Boolean} [fireErr] flag to force or preserve error firing.
@return {zebkit.DoIt}
@method image
@for  zebkit
Load image or complete the given image loading .