ngx-lightbox icon indicating copy to clipboard operation
ngx-lightbox copied to clipboard

data:image/png;... not working

Open AbhinavAtul opened this issue 3 years ago • 1 comments

  1. included the lightbox.css
  2. no error on console,
  3. tried passing both dataUri = data:image,.... and safeUrl = this.domSanitizer.bypassSecurityTrustUrl(dataUri), no error on console either
this.lightBox.open(
                [{
                    src: dataUri, //also tried this.domSanitizer.bypassSecurityTrustUrl(dataUri)
                    caption: '',  
                    thumb: '', //also tried dataUri or the safeurl directly
                }],
 0
 )

AbhinavAtul avatar Nov 07 '20 23:11 AbhinavAtul

Just a quick hack, if you want to get it up and running:

LightboxComponent.prototype._validateInputData = function () {
    // if (this.album &&
    //     this.album instanceof Array &&
    //     this.album.length > 0) {
    //     for (var i = 0; i < this.album.length; i++) {
    //         // check whether each _nside
    //         // album has src data or not
    //         if (this.album[i].src) {
    //             continue;
    //         }
    //         throw new Error('One of the album data does not have source data');
    //     }
    // }
    // else {
    //     throw new Error('No album data or album data is not correct in type');
    // }
    // // to prevent data understand as string
    // // convert it to number
    // if (isNaN(this.currentImageIndex)) {
    //     throw new Error('Current image index is not a number');
    // }
    // else {
    //     this.currentImageIndex = Number(this.currentImageIndex);
    // }
    return true;
};
LightboxComponent.prototype._registerImageLoadingEvent = function () {
    var _this = this;
    var preloader = new Image();
    preloader.onload = function () {
        _this._onLoadImageSuccess();
    };
    var src = this.album[0].src;
    preloader.src = src; //this._sanitizer.sanitize(core_1.SecurityContext.URL, src);
};

BerndtHamboeck avatar Nov 30 '20 17:11 BerndtHamboeck