retrieve size of jpg from the internet

Bookit Enterprises bookit.grant at
Tue Dec 15 17:09:09 EST 2020

I have code which successfully retrieves a .jpg image stored on my company website.

I would also like to retrieve the pixel height and width of the image.  Anyone know if that is possible?

Here’s the code I am using.

Begin text block
Text: GET [con('/image/pictures',StPictureFile,'/',StNumber,'.jpg')] HTTP/1.1 (Carriage return,Linefeed)
Text: Accept: image/jpeg (Carriage return,Linefeed)
Text: Accept-Language: fr, en-us;q=0.66, en;q=0.33 (Carriage return,Linefeed)
Text: Accept-Encoding: gzip, deflate (Carriage return,Linefeed)
Text: User-Agent: Mozilla/33.0  (Carriage return,Linefeed)
Text: Host: [iHost] (Carriage return,Linefeed)
Text: Connection: keep-alive  (Carriage return,Linefeed)
Text:  (Carriage return,Linefeed)
End text block
Get text block lvHeader

HTTPOpen (iHost) Returns lvSocket
If lvSocket<0
Calculate iPicture as ''
Redraw {iPicture}
HTTPSend (lvSocket,lvHeader) 
HTTPRead (lvSocket,lvBinary) 
If pos('404 Not Found',lvBinary)>0
Calculate iPicture as ''
Redraw {iPicture}
HTTPClose (lvSocket) 
Calculate lvFind as chartoutf8(con(kCr,kLf,kCr,kLf))
Calculate lvPos as binsearch(lvFind,lvBinary)
Calculate lvBinary as bytemid(lvBinary,lvPos+4,binlength(lvBinary)-1)
;  ---------------
Do pictconvfrom("jpeg",lvBinary) Returns iPicture
Redraw {iPicture}
End If
End If

More information about the omnisdev-en mailing list