load image from a website

Posted By: Kartoffel

load image from a website - 01/29/16 15:27

Hey there,

I'm trying to load an image from a website. I already tried
acknex's http_-functions but it doesn't really work. http_result
returns the correct size of the recieved data (exactly the same
as the image), however, the string in which the received data
is stored only contains the image's header; it doesn't seem to
contain the rest of the file.

Maybe someone knows how to do this properly?
Posted By: Ch40zzC0d3r

Re: load image from a website - 01/29/16 16:16

How do you display the byte array?
It sounds like you displayed it like a string using a MessageBox?
A string is cut off when it reads the nullterminator which is a plain 0
Posted By: Kartoffel

Re: load image from a website - 01/29/16 16:25

I save it into a text file using a loop (maximum is the size which http_result() returned) and file_asc_write.

This is the result:


Top is received, bottom is the original image (in this case the a8 logo for testing)

as you can see, the string doesn't receive all the data. so file_asc_write is writing some data from the ram that is located after the string.
Posted By: Ch40zzC0d3r

Re: load image from a website - 01/29/16 17:11

You should use a proper hex editor to see at which byte its failing.
Also please post some code, I never used the engines http stuff.
Posted By: Kartoffel

Re: load image from a website - 01/29/16 19:56

Looks like the problem is the http_result() function.
It stops writing data into the target string after what seems to be some special character.
...which means there's most likely no possible workaround.
Posted By: Ch40zzC0d3r

Re: load image from a website - 01/29/16 20:02

Well, if you would offer some more infos Im sure we can find a workarround for you.
If everything fails you can use winapis (sockets) to obtain the data.
Easiest workarround for now seems to be Base64 encoding.
Posted By: Kartoffel

Re: load image from a website - 01/29/16 20:37

I offered pretty much all there is to know confused

- I'm using http_sendpost to get an httpID
- I use http_result to write the received data into a string

That's all
Posted By: Ch40zzC0d3r

Re: load image from a website - 01/29/16 21:23

Well, http_result returns a string.
I guess it simply stops after reading 0x00, you can simply use base64 encoding and your problem is solved.
Posted By: Kartoffel

Re: load image from a website - 01/29/16 21:30

But I don't think I can force a website to send the requested file as base64 encoded data smirk
I'm not trying to load file from my website, but from another.
Posted By: Ch40zzC0d3r

Re: load image from a website - 01/29/16 21:47

You can make your own script which receives the link as parameter and returns the content as base64. Otherwise just use winapis / sockets
Posted By: Dico

Re: load image from a website - 01/29/16 22:07

for my old dv store browser i just use media_play to get images and videos from web . but it need another thread bec the media_play can freeze the engine until he get the images from the web.

you can see here the media_play get the correct size : https://www.youtube.com/watch?v=5lQLw3TBAG4
© 2024 lite-C Forums