-
Notifications
You must be signed in to change notification settings - Fork 18
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
Use lightbox with blob object url #32
Comments
Sorry, this module does not work with Blob type currently. |
@rpereira3 you should get the dataURL from your blob object. private _createImageSrcFromBlob(image, blob: Blob) {
const reader = new FileReader();
reader.addEventListener('load', () => {
image['src'] = this._sanitizer.bypassSecurityTrustUrl(reader.result);
this._changeDetector.detectChanges();
}, false);
if (blob) {
reader.readAsDataURL(blob);
}
} and then use it as suggested at the end of the issue #11 (take a look to this demo-example branch) |
Should be fixed now ! |
That works now, thx ! |
I try to use angular2-lightbox with object url like this :
{ src: URL.createObjectURL(image.blob), caption: null, thumb: null }
Variable image.blob is a Blob.
But i have the error in the console :
unsafe:blob:http://localhost:4200/280f04e8-a864-40f1-ba97-fb8f2379ca07:1 GET net::ERR_UNKNOWN_URL_SCHEME
I try :
{src: this.sanitizer.bypassSecurityTrustUrl(URL.createObjectURL(image.blob)), caption: null, thumb: null}
or
{src: this.sanitizer.bypassSecurityTrustResourceUrl(URL.createObjectURL(image.blob)), caption: null, thumb: null}
Now i have the error :
SafeValue%20must%20use%20[property]=binding:%20blob:http://localhost:4200/1861e3df-564f-4e18-864b-cb1e27efb2ef%20(see%20http://g.co/ng/security#xss):1 GET http://localhost:4200/SafeValue%20must%20use%20[property]=binding:%20blob:http://localhost:4200/1861e3df-564f-4e18-864b-cb1e27efb2ef%20(see%20http://g.co/ng/security 404 (Not Found)
In my view, the image works :
`
But in my navigator, i have just the backdrop with a blank lightbox.
It's a bug or it's impossible to use the module with blob object url ?
The text was updated successfully, but these errors were encountered: