Hi,

I am doing the same thing in my code in Lazarus/Mac OS X, and it loads from 
disk into the image component afterwards with no issues.  I can send the 
relevant code if you would like.


Thank you,
    Noah silva 

On 2011/07/01, at 16:27, Felipe Monteiro de Carvalho 
<felipemonteiro.carva...@gmail.com> wrote:

> 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