NativeScript / nativescript-angular

Integrating NativeScript with Angular
http://docs.nativescript.org/angular/tutorial/ng-chapter-0
Apache License 2.0
1.21k stars 241 forks source link

Issue with image urls #2255

Open Skillnter opened 3 years ago

Skillnter commented 3 years ago

Environment https://play.nativescript.org/?template=play-ng&id=GYAGpS&v=379

Describe the bug Local images work fine but when change to placeholder.com images(https://via.placeholder.com/150.jpg) or any other online image URLs, it throws an error.

Works with this URL

https://nativescript.org/assets/ns-logo_share_600x315.png

but not with the following or any other. How will I be able to set images from my server?

https://via.placeholder.com/150.jpg

Expected behavior

Sample project https://play.nativescript.org/?template=play-ng&id=GYAGpS&v=379

Additional context Tried in multiple phones too and the emulator

Device Logs:

[Galaxy Note10+]: Error in downloadBitmap - java.io.FileNotFoundException: https://via.placeholder.com/150.jpg

[Galaxy Note8]: Error in downloadBitmap - java.io.FileNotFoundException: https://via.placeholder.com/150.jpg

JS: Error in downloadBitmap - java.io.FileNotFoundException: https://via.placeholder.com/150.jpg

iamabs2001 commented 3 years ago

hey its working fine but your link is not a valid image link its a webpage link

image

other images are working fine

Screenshot_20200930-095853

Skillnter commented 3 years ago

Any image that you will open in the browser will look likes this: image

image

Additionally adding response headers too for comparing: image

image

For png/jpg concerns : [Galaxy Note10+]: Error in downloadBitmap - java.io.FileNotFoundException: https://via.placeholder.com/150.png

image

But I don't see any difference between those links. I don't understand what you are pointing at?

iamabs2001 commented 3 years ago

Sir i meant that your link is not valid image try this

in your use

that means its not a proper bit image

iamabs2001 commented 3 years ago

You must give a proper file(image) link.

image can be extension of .png .jpg etc or maybe without extension but link must be of an image not other file

Skillnter commented 3 years ago

You must give a proper file(image) link.

image can be extension of .png .jpg etc or maybe without extension but link must be of an image not other file

Checked the link on various sites (if it is a valid image link or not). https://exifinfo.org/detail/x_SzPFOjuAM0wkcPhzyBGQ

It is still not convincing. This irregularity gives me little to no confidence that it can work properly all the time. 1 link like that and the app goes weird.

Can you provide any code or something to track if that link is valid or not? This will be more helpful because all the sites or codes I try to check if the above link is a valid image link or not, I am not getting the result that you are too convinced to say.

Skillnter commented 3 years ago

Sir i meant that your link is not valid image try this

in your use

that means its not a proper bit image

Well, we can configure to serve images irrespective of the extension as we do with .php or .html files. there are many websites that actually do this too. https://www.printvenue.com/static/polo-tshirt-banner-2019

Not a good point to go by.

As I said, it will be better if any code can check the validity of the link which can give the result that you are stating, will be helpful as I tried but getting just the opposite of what you are stating.

iamabs2001 commented 3 years ago

i never said extension is required, the proper valid image link is required here its a image without extension https://www.printvenue.com/static/polo-tshirt-banner-2019 try adding extension will cause not found https://www.printvenue.com/static/polo-tshirt-banner-2019.png

but in your link add anything, its return a page, in case if it is a file then you can only able to access through that specific file url

Skillnter commented 3 years ago

i never said extension is required, the proper valid image link is required here its a image without extension https://www.printvenue.com/static/polo-tshirt-banner-2019 try adding extension will cause not found https://www.printvenue.com/static/polo-tshirt-banner-2019.png

but in your link add anything, its return a page, in case if it is a file then you can only able to access through that specific file url

Like I said earlier, we can configure our server to return image irrespectiveof the extension. Calling it an invalid image link is not right as you are getting served by an image all the time.

So unless you can provide some code that can tell that the specified link is not serving a valid image, this point can be nothing more than spam. As this is not serving any valid or logical point as the served item is an image.

but in your link add anything, its return a page, in case if it is a file then you can only able to access through that specific file URL

If you open an image on browser.. you will see it as page lol :/ Check the content-type.. it is an image, not a page lol

It would be better to provide some code otherwise all are just baseless points. And we can't move forward without that.

Skillnter commented 3 years ago

i never said extension is required, the proper valid image link is required here its a image without extension https://www.printvenue.com/static/polo-tshirt-banner-2019 try adding extension will cause not found https://www.printvenue.com/static/polo-tshirt-banner-2019.png

but in your link add anything, its return a page, in case if it is a file then you can only able to access through that specific file url

Any workable code for testing as discussed above? I can not move forward without that.

iamabs2001 commented 3 years ago

See a live wallpaper app using nativescript

https://play.google.com/store/apps/details?id=org.iamabs.lyrica

Skillnter commented 3 years ago

See a live wallpaper app using nativescript

https://play.google.com/store/apps/details?id=org.iamabs.lyrica

not helping with my above-described problem. Can you provide any code to justify your hypothesis?