Felipe,

Your code works with Delphi2006 and Synapse svn 114. Tried downloading
several other gifs and they are all fine.

Ludo

> -----Message d'origine-----
> De : Felipe Monteiro de Carvalho 
> [mailto:felipemonteiro.carva...@gmail.com] 
> Envoyé : vendredi 1 juillet 2011 09:28
> À : Ararat Synapse
> Objet : [Synalist] Loading images via http
> 
> 
> Hello,
> 
> I am trying to load an image via http, so I simply issue a 
> HTTP request for it and then I will try to save it to the 
> disk, something like this:
> 
> var
>   Client: THttpSend;
>   i: Integer;
> begin
>   Client := THttpSend.Create;
>   try
>     Client.Headers.Add('Accept:       image/png, image/jpeg, 
> image/gif');
>     Client.Headers.Add('Accept-Language:      en-gb,en;q=0.5');
>     Client.Headers.Add('Accept-Charset:       
> utf-8;q=0.7,*;q=0.7'); // ISO-8859-1,
> 
> //  Client.UserAgent := AUserAgent;
>     Client.HttpMethod('GET', 
> 'http://www.cs.ucf.edu/courses/testpage/tinyUCF.gif');
> 
>     Client.Document.Position := 0;
>     ADest := TMemoryStream.Create;
>     ADest.CopyFrom(Client.Document, Client.Document.Size);
>     ADest.SaveToFile('/Users/felipe/test.gif');
> 
>     {$IFDEF FPB_DEBUG_IMAGE_LOAD}
>     ContentsList.LoadFromStream(Client.Document);
> 
>     WriteLn('Starting to receive image: ' + AURL);
>     for i := 0 to ContentsList.Count-1 do
>       WriteLn(ContentsList.Strings[i]);
> 
>     Contents := ContentsList.Text;
>     {$ENDIF}
>   finally
>     Client.Free;
>   end;
> end;
> 
> But the image that I save to my HD is not valid =O I added 
> more debug info and checked that there is no http header in 
> the beginning of the message, so I suppose that it starts 
> directly with the binary data, or not? Another possibility: 
> Maybe the data uses some kind of encoding instead of being 
> raw binary data?
> 
> I just though that maybe someone here will know the answer to this =D
> 
> Any ideas?
> 
> thanks,
> -- 
> Felipe Monteiro de Carvalho
> 
> --------------------------------------------------------------
> ----------------
> All of the data generated in your IT infrastructure is 
> seriously valuable. Why? It contains a definitive record of 
> application performance, security 
> threats, fraudulent activity, and more. Splunk takes this 
> data and makes 
> sense of it. IT sense. And common sense. 
> http://p.sf.net/sfu/splunk-d2d-c2 
> _______________________________________________
> synalist-public mailing list synalist-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/synalist-public
> 


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to