09.02.2019, 19:30
|
Новичок
|
|
Регистрация: 22.04.2012
Сообщения: 99
Репутация: 10
|
|
Загрузка картинок из интернета
Скачиваю 97 картинок с сайта (имена картинок 1,2,3 и т.д. .jpg).Подскажите пожалуйста что не так! скачиваются 97 одинаковых картинок!
Код:
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IdHttp, jpeg, Vcl.StdCtrls, Vcl.ExtCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
http: TIdHttp;
potok: TMemoryStream;
jpeg: TJpegImage;
i:integer;
begin
http := TIdHTTP.Create(nil);
ms := TMemoryStream.Create;
jpeg := TJpegImage.Create;
for i:= 1 to 97 do
begin
try
http.Get('//тут источник картинок'+inttostr(i)+'.jpg', potok);
potok.Position := 0;
jpeg.LoadFromStream(ms);
jpeg.SaveToFile('c:/jpgimage/'+inttostr(i)+'.jpg');
finally
jpeg.Free; ms.Free; http.Free;
end;
end;
end;
end.
|