Главная страница
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.016 c
1-24517
Andrey V.
2003-08-27 08:22
2003.09.08
колонки в ListBox


6-24577
SPeller
2003-07-04 19:17
2003.09.08
Докачка файлов по протоколу HTTP


4-24739
mox
2003-07-08 11:45
2003.09.08
Почему не копируется текст edit-ов др.окна


1-24409
Sfagnum
2003-08-25 17:21
2003.09.08
не получаеться обратиться к массиву


1-24446
Skier
2003-08-25 12:52
2003.09.08
---|Ветка была без названия|---