Download the pictures locally from the server and process them
Procedure Tform3.imgshow (filename:string);
Var
Imagestream:tmemorystream;
Jpg:tjpegimage;
imgfile:string;
Bmp1,bmp2:tbitmap;
W1,h1:integer;
Begin
Try
Upload pictures from the web to local, write to the data stream when downloading
imgfile:= ' http://192.168.X.X/Images/' +filename;
ImageStream: = Tmemorystream.create ();
Jpg:=tjpegimage.create;
IDHTP1. Get (Imgfile,imagestream);
ImageStream. position:=0;
Jpg. Loadfromstream (ImageStream);
Scale the picture to 900*450
BMP1: =tbitmap.create;
BMP2: =tbitmap.create;
bmp1.assign (jpg);
W1:=bmp1.width;
H1:=bmp1.height;
Bmp2.width: =w1*900 div W1;
Bmp2.height: =h1*450 div H1;
Setstretchbltmode (Bmp2.canvas.handle,halftone);
StretchBlt (bmp2.canvas.handle,0,0,900,450,
Bmp1.canvas.handle,0,0,w1,h1,srccopy);
Save picture
Jpg. Assign (BMP2);
Jpg. SaveToFile (strfilepath+ ' +filename);
Finally
Jpg. Free;
Bmp1.free;
Bmp2.free;
End
End
This article is from the "Imagine the Sky" blog, please be sure to keep this source http://kinwar.blog.51cto.com/3723399/1617594
Download server pictures with Tidhttp