O$5.1.1 Loading image file to a variable using HTTPRead.
kellyb at montana.com
Tue Jul 4 03:13:14 EDT 2017
>Has anyone an easier, more workable solution to retrieving an image from a website please?
Easier than what?
The code below pulls a jpg file into a picture field. At the line 'Calculate iPicture as binField' you could do WriteBinFile(path,binField) instead. Works in Studio 4.3.1 with http urls, works in Studio 5 and up with https urls.
But the url you cited isn't a normal JPG, it's some kind of photoshop format starting with FFD8 like a normal jpg, but then FFED which is I don't know what - so save to file will work, but showing it in an Omnis picture field may not.
Hope it helps,
Calculate url as 'http://www.kellyb.com/RosettaOnLion.jpg'
HTTPPage (url) Returns binField
Calculate size as binlength(binField)
Calculate headerBreak as binfromhex('0D0A0D0A')
Calculate pos as binsearch(headerBreak,binField)
Calculate binField as bytemid(binField,pos+4,size-1)
Calculate iPicture as binField
More information about the omnisdev-en