Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data:image/png;... not working #73

Open
AbhinavAtul opened this issue Nov 7, 2020 · 1 comment
Open

data:image/png;... not working #73

AbhinavAtul opened this issue Nov 7, 2020 · 1 comment

Comments

@AbhinavAtul
Copy link

  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
 )
@BerndtHamboeck
Copy link

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);
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants