kolkov / ngx-gallery

A simple responsive native gallery component for Angular 8+.
https://ngx-gallery.kolkov.ru/
MIT License
115 stars 56 forks source link

I need to pass a token authorization (bearer). #35

Closed andrejm7 closed 4 years ago

andrejm7 commented 4 years ago

Good Morning

this library is too much.

but I have found problems with the links

this.galleryImages.push ( { small: https://xxxx, medium: https://xxxx, big: https://xxxx } );

this is because I need to pass a token authorization (bearer).

how can i solve this problem of mine?

appreciate

andrejm7 commented 4 years ago

????

kolkov commented 4 years ago

Hi! I think you need to use request interceptors, but I am not sure is it possible in this case.

kolkov commented 4 years ago

https://stackoverflow.com/questions/41013632/how-to-set-authorization-header-on-background-image-url

kolkov commented 4 years ago

https://stackoverflow.com/questions/47811784/passing-authorization-header-for-images-src-to-remote-server-in-ionic-page

kolkov commented 4 years ago

https://medium.com/javascript-in-plain-english/loading-images-with-authorization-8aab33663ba6

kolkov commented 4 years ago

https://stackoverflow.com/questions/38810956/set-background-image-to-a-blob-uri

andrejm7 commented 4 years ago

thanks for the feedback. @kolkov i tried to do it according to this link .. look at the problem i have now .. i have 200 status but images .. but in ngx-gallery it doesn't show the image

https://github.com/lukasz-galka/ngx-gallery/issues/322#issuecomment-640988978

kolkov commented 4 years ago

thanks for the feedback. @kolkov i tried to do it according to this link .. look at the problem i have now .. i have 200 status but images .. but in ngx-gallery it doesn't show the image

lukasz-galka/ngx-gallery#322 (comment)

You need yo use blob url as image url.

andrejm7 commented 4 years ago

yes .. i tried to do that .. but the image does not appear .. look at the problem ..

image

kolkov commented 4 years ago

@andrejm7 Provide an repo please.

andrejm7 commented 4 years ago

https://stackblitz.com/edit/angular-ivy-amefyb?file=src%2Fapp%2Fapp.component.ts

there is the problem. Why doesn't 4 image appear?

I have a blob service return. And adding to galleryImages I can't see the image.

just complementing .. base64 images would also be an option does not work too ... In <img [src] = imageBase64> yes it works.

kolkov commented 4 years ago

https://github.com/kolkov/ngx-gallery/tree/test_blob try this solution or the same other.

andrejm7 commented 4 years ago

i had this problem now ..

Error: Cannot read property 'startsWith' of undefined Unable to display error. Open your browser's console to view.

I'm using like this

const objUrl = 'data: image/jpeg; base64,' + baseImage.image;

or

const objUrl = 'data: image/png; base64,' + baseImage.image;

kolkov commented 4 years ago

My example works, try to do by analogy...

kolkov commented 4 years ago

Try to post your support question with example to https://stackoverflow.com/ please. Thanks!