Downloading A Binary Image From A Web Server

ErickAsas

Member
Licensed User
Longtime User
Hi Erel,

My images are stored in a database as binary data. I have a web server which renders these binary images upon request. I want to download and display this image in an imageview control. How can I do this?

The examples I have seen here downloads images with fixed url paths, example, "http://www.b4x.com/android/images/wiki_logo.png". With binary images, I don't have a path, just the webpage url that renders it.

Hope you can help me.

Thanks.

ErickAsas
:sign0163:
 

warwound

Expert
Licensed User
Longtime User
How do you add these images to a standard web page?
Do you have a (PHP?) script that gets the binary data by querying the database and re-creates an image - returning that image to whatever started the script?

Does your web page HTML look something like:
B4X:
<img src="path/to/my_image_creator_script.php" />

Martin.
 
Upvote 0

ErickAsas

Member
Licensed User
Longtime User
Yes warwound. That is definitely the case.

I am using asp and ado to return the binary image like below.


<IMG SRC="attachmentsget.asp?value=<%=pageID%>">

Hope you can help and thanks in advance.
 
Upvote 0

ErickAsas

Member
Licensed User
Longtime User
Hi Martin,

I'm currently testing out httputils2.

I was able to get the response from the server(Job.Success = True). I've tried getting the result as Job.GetBitmap but there is an error in loading the bitmap.

I am currently trying to get the result as Job.GetInputStream. I am thinking of saving the input stream first to a file on the sdcard and loading it to an imageview control.

Would this be in the right direction?

Thanks in advance
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Check the log and if you don't see any related error messages then uncheck the Filter checkbox and look again.
Are there any errors logged?

If not then the first thing i'd establish is whether the image created by your attachmentsget.asp script is valid - is it in a format that B4A/Android supports?
Does your script output JPG, GIF, BMP or another format of image?

If you're sure the script is outputting image data that is supported by B4A/Android then you'll have to do some detective work to track where the problem is...

Martin.
 
Upvote 0
Top