Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.09.08;
Скачать: CL | DM;

Вниз

Indy HTTP server   Найти похожие ветки 

 
ASTARD   (2003-06-30 19:21) [0]

Не подскажите как сделать так что бы вместе с текстом ХТМЛ уходили клиенту (Internet Explorer) и картинки прописаные в этом ХТМЛ(<IMG SRC=>)? Иван. Спасибо!!!


 
AL_!   (2003-07-01 02:50) [1]

LOL !... :)


 
vidiv ©   (2003-07-01 07:39) [2]

Я бы написал сюда код программы которая по inHTTPServer посылает картинку, но ведь модераторы замодерят код, но часть его пожалуйста:

procedure TForm1.HTTPSerCommandGet(AThread: TIdPeerThread;
RequestInfo: TIdHTTPRequestInfo; ResponseInfo: TIdHTTPResponseInfo);
var s:TMemoryStream; b:Tbitmap; dc:hdc;
jpg:TJPEGImage;
q:integer;
begin
log(Request: "+RequestInfo.Command+"; "+RequestInfo.RemoteIP);
if CheckAuth.Checked and (
(not RequestInfo.AuthExists) or
(RequestInfo.AuthUsername<>AuthLogin.Text) or
(RequestInfo.AuthPassword<>AuthPasswd.Text) ) then
begin
log("Auth!");
ResponseInfo.ContentType := "text/html";
ResponseInfo.AuthRealm := authtext.Text;
ResponseInfo.ContentText := "<html><body><font size=5>Vid Internet Screen Viewer</font><br><font size=4 color=red> Auth Needed!</font></body></html>";
ResponseInfo.WriteHeader;
ResponseInfo.WriteContent;
exit;
end;
if uppercase(RequestInfo.Document)="/IMG" then
begin
b:=TBitmap.Create;
b.Width := Screen.Width;
b.Height := Screen.Height;
jpg := TJPEGImage.Create;
dc:=getdc(0);
BitBlt(b.Canvas.Handle,0,0,b.Width,b.Height,dc,0,0,SRCCOPY);
DeleteDC(dc);
jpg.Assign(b);
b.free;
q := StrToIntDef(RequestInfo.Params.Values["q"],TrackBar1.Position);
if not (q in [1..100]) then q:=TrackBar1.Position;
jpg.CompressionQuality := q;
jpg.Compress;
ResponseInfo.ContentStream:=TMemoryStream.Create;
jpg.SaveToStream(ResponseInfo.ContentStream);
jpg.Free;
ResponseInfo.ContentType := "image/jpeg";
end else
begin
ResponseInfo.ContentType := "text/html";
q := StrToIntDef(RequestInfo.Params.Values["q"],TrackBar1.Position);
if not (q in [1..100]) then q:=TrackBar1.Position;
ResponseInfo.ContentText := "<html><title>Vid Internet Screen Viewer</title><body>"+
( q)
Я бы написал сюда код программы которая по inHTTPServer посылает картинку, но ведь модераторы замодерят код, но часть его пожалуйста:

procedure TForm1.HTTPSerCommandGet(AThread: TIdPeerThread;
RequestInfo: TIdHTTPRequestInfo; ResponseInfo: TIdHTTPResponseInfo);
var s:TMemoryStream; b:Tbitmap; dc:hdc;
jpg:TJPEGImage;
q:integer;
begin
log(Request: "+RequestInfo.Command+"; "+RequestInfo.RemoteIP);
if CheckAuth.Checked and (
(not RequestInfo.AuthExists) or
(RequestInfo.AuthUsername<>AuthLogin.Text) or
(RequestInfo.AuthPassword<>AuthPasswd.Text) ) then
begin
log("Auth!");
ResponseInfo.ContentType := "text/html";
ResponseInfo.AuthRealm := authtext.Text;
ResponseInfo.ContentText := "<html><body><font size=5>Vid Internet Screen Viewer</font><br><font size=4 color=red> Auth Needed!</font></body></html>";
ResponseInfo.WriteHeader;
ResponseInfo.WriteContent;
exit;
end;
if uppercase(RequestInfo.Document)="/IMG" then
begin
b:=TBitmap.Create;
b.Width := Screen.Width;
b.Height := Screen.Height;
jpg := TJPEGImage.Create;
dc:=getdc(0);
BitBlt(b.Canvas.Handle,0,0,b.Width,b.Height,dc,0,0,SRCCOPY);
DeleteDC(dc);
jpg.Assign(b);
b.free;
q := StrToIntDef(RequestInfo.Params.Values["q"],TrackBar1.Position);
if not (q in [1..100]) then q:=TrackBar1.Position;
jpg.CompressionQuality := q;
jpg.Compress;
ResponseInfo.ContentStream:=TMemoryStream.Create;
jpg.SaveToStream(ResponseInfo.ContentStream);
jpg.Free;
ResponseInfo.ContentType := "image/jpeg";
end else
begin
ResponseInfo.ContentType := "text/html";
q := StrToIntDef(RequestInfo.Params.Values["q"],TrackBar1.Position);
if not (q in [1..100]) then q:=TrackBar1.Position;
ResponseInfo.ContentText := "<html><title>Vid Internet Screen Viewer</title><body>"+
"Quality: "+inttostr(q)+"%<br><img name="ab" src="img?q="+RequestInfo.Params.Values["q"]+"&tmp="+inttostr(random(maxint))+""></body></html>"
end;
end;


uses jpeg; не забудь


 
Gigabyte ©   (2003-07-02 21:15) [3]

Когда я использовал TIdHTTPServer. Он у меня без всяких этих кодов сам автоматически пересылал картинки. Все, что ему требовалось, это открыть картинку и передать ее в поток. посредстром TStream.CopyFrom(). И больше никаких ухищрений типа

b:=TBitmap.Create;
b.Width := Screen.Width;
b.Height := Screen.Height;
jpg := TJPEGImage.Create;
dc:=getdc(0);
BitBlt(b.Canvas.Handle,0,0,b.Width,b.Height,dc,0,0,SRCCOPY);
DeleteDC(dc);
jpg.Assign(b);
b.free;
q := StrToIntDef(RequestInfo.Params.Values["q"],TrackBar1.Position);
if not (q in [1..100]) then q:=TrackBar1.Position;
jpg.CompressionQuality := q;
jpg.Compress;
ResponseInfo.ContentStream:=TMemoryStream.Create;
jpg.SaveToStream(ResponseInfo.ContentStream);
jpg.Free;
ResponseInfo.ContentType := "image/jpeg";

Я не использовал. И РАБОТАЕТ!



Страницы: 1 вся ветка

Текущий архив: 2003.09.08;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.023 c
6-24611
ser
2003-06-17 12:49
2003.09.08
Работа с IMAP INDY 9.0


1-24419
pavel_guzhanov
2003-08-25 17:49
2003.09.08
Delphi & Excel


3-24305
demonyator
2003-08-18 17:39
2003.09.08
Order by и редактирование...


6-24584
Chaos
2003-07-04 16:46
2003.09.08
Как узнать ср-вами D6 что кто-то подключился к моему компу


7-24722
Dmitriy M. Volkov
2003-06-24 13:51
2003.09.08
Замена стандартного taskmgr в WinXP