Possible Duplicate:
How to get images from URL in Delphi
I’m using Delphi 2010,with some functions i can download and show JPG or PNG pictures in cximage or image object in a form, but i’m trying to do without download the picture to hard drive,i was wondering is that possible ? I searched via google & stackoverflow but couldn’t find, all samples are about the download the file.
For example,i added an cximage1 to my form and want to show an picture from an url like “http://www.someaddress.com/pictures/001.JPG“.
Thanks for all helps,and sorry for bad English 🙂
You can use this function (compiled and tested using Delphi 2010) to download a file over HTTP and store it in a TBitMap. It’ll read all file types that have a registered support in Delphi’s TGraphic hiearachy, and will auto-detect BMP, GIF, JPG and PNG file formats:
If you already know the file type, you can specify it as the 2nd parameter as either TGifImage, TPngImage, TJPegImage or TBitMap. If not, the routine will try to auto-detect it among these four types. If you use a custom-graphic type, you’ll need to specify it as the 2nd parameter or update the auto-detection logic to detect it.
So, if you want to use it to display a downloaded image in a TImage without saving it to disc, you can use it thus: