Главная страница
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.017 c
9-24293
com2003
2003-03-04 20:08
2003.09.08
Вращение


6-24605
miguel1
2003-07-02 17:28
2003.09.08
Ошибка в кодировке при отправке E-Mail с помощью INDY


4-24747
Spawn
2003-07-05 18:40
2003.09.08
Хуки


14-24639
Nik8.
2003-08-21 12:13
2003.09.08
Память чужой проги


7-24732
_Narayan_
2003-06-23 23:20
2003.09.08
реестр