Android Question Download image

RUNO

Active Member
Licensed User
Longtime User
I have two domains ,the first is free and second paid, if I downloaded image from the free domain no problem but I can't from paid domain I got this error
The attached file is a sample of the problem, so can someone help me?

B4X:
httpjob_getbitmap (java line: 170)
java.lang.RuntimeException: Error loading bitmap.
    at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize2(CanvasWrapper.java:539)
    at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:517)
    at anywheresoftware.b4a.keywords.Common.LoadBitmap(Common.java:1342)
    at b4a.example.httpjob._getbitmap(httpjob.java:170)
    at b4a.example.main$ResumableSub_Activity_Create.resume(main.java:411)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:267)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:207)
    at anywheresoftware.b4a.keywords.Common$11.run(Common.java:1178)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6669)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
 

Attachments

  • test.zip
    3 KB · Views: 219

JohnC

Expert
Licensed User
Longtime User
Please don't post duplicate posts on the same issue:

 
Upvote 0

RUNO

Active Member
Licensed User
Longtime User
Please don't post duplicate posts on the same issue:

I'm sorry
First : I don't know the laws of the forum .
Second : I need helping for my problem
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Second : I need helping for my problem

Since it appears you need someone to contact another company to help get your app to work with their service, you could try hiring someone in the "Jobs" section:
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
The attached file is a sample of the problem
The url does not return a Bitmap.

It returns the htmlcode which is invalid btw...
B4X:
<p align='center'> <font color=green size='5pt'>بسم الله الرحمن الرحيم</font> </p><p align='center'> <font color=green size='5pt'>اللهم صل وسلم على سيدنا ونبينا محمد  </font> </p><p align='center'> <font color=green size='5pt'>سبحان الله وبحمده سبحان الله العظيم </font> </p><p align='center'> <font color=red size='4pt'>مرحبا بك عزيزي الزائر ونرجوا منك تحميل التطبيق بالنقر على الصورة التي في الاسفل  </font> </p><p align='center'> <font color=black size='6pt'>تطبيق عندك  </font> </p>
<style>
.aligncenter {
    text-align: center;
}
</style>
<p class="aligncenter">
    <a href="default.php"><img src="image/im1/g.png" alt="centered image" width="300" height="200"/></a>

</p>
<!-- <a href="default.asp"><img src="image/im1/Playstore.png" alt="test page" class="aligncenter"></a>  -->
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
B4X:
<p class="aligncenter">
    <a href="default.php"><img src="image/im1/g.png" alt="centered image" width="300" height="200"/></a>
</p>
As you can see, the image that the resulting page displays is at the same location "/image/im1/g.png" that he is trying to download it directly from.

But, as I mentioned in the other thread, it looks like there is some server code that is redirecting his request to a full HTML page (with bad HTML coding as you see) that hosts that image.

So, my only thought (as I mentioned in the other thread) is that he needs to contact the website owner to find out how to download the image directly.
 
Last edited:
Upvote 0

emexes

Expert
Licensed User
Longtime User
it looks like there is some server code that is redirecting his request to a full HTML page (with bad HTML coding as you see) that hosts that image.
and sometimes the exact same URL returns just the image, without the extra HTML. If I right-click on the image in the extra-HTML version and chose "Open image in new tab", and it returns just the image.

Perhaps it is a caching or load-balancing issue, where what should be the same http data is stored twice, perhaps on different computers, and one of the versions didn't get updated, and you are randomly getting one or the other depending on which way the wind's blowing or something random like that.

https://omj2020.com/image/im1/g.png

edit: this link seems to reliably land on the image directly, as expected, but if I then click in the address bar of that image's browser window and press Enter, it also reliably then brings up the extra-HTML version. ?
 
Last edited:
Upvote 0

emexes

Expert
Licensed User
Longtime User
FWIW WGET seems to reliably get the extra-HTML version (950 bytes, including link to png, not the actual png data)
C:\UTIL> wget "https://omj2020.com/image/im1/g.png"
--2020-07-25 05:01:08-- https://omj2020.com/image/im1/g.png
Resolving omj2020.com (omj2020.com)... 185.201.11.89
Connecting to omj2020.com (omj2020.com)|185.201.11.89|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://omj2020.com [following]
--2020-07-25 05:01:11-- http://omj2020.com/
Connecting to omj2020.com (omj2020.com)|185.201.11.89|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://omj2020.com/ [following]
--2020-07-25 05:01:11-- https://omj2020.com/
Connecting to omj2020.com (omj2020.com)|185.201.11.89|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 950 [text/html]
Saving to: 'g.png'

g.png 100%
[===============================================================================>] 950 --.-KB/s in 0s

2020-07-25 05:01:13 (2.27 MB/s) - 'g.png' saved [950/950]

C:\UTIL>
 
Upvote 0
Top