The problem, perhaps, is in s.readstring.
=================================
//dbimage.inc line 135

procedure TDBImage.LoadPicture;
var //s        : TMemory; // ( lazarus team)
    s        : TMemoryStream; // ( mine )
    GraphExt : string;
    gc       : TGraphicClass;
    AGraphic : TGraphic;

begin
  if not FPictureLoaded then
    begin
    FUpdatingRecord := True;
    if not assigned(FDatalink.Field) then Picture.Assign(FDatalink.Field)
    else
    if FDatalink.field.IsBlob then
      begin
      if FDatalink.field is TBlobField then
        begin
        if FDatalink.Field.IsNull then
          begin
          Picture.Clear;
          exit;
          end;
    //FDataLink.DataSet.CreateBlobStream(FDataLink.Field,bmRead); //
(lazarus team)

    s := TMemoryStream.create; // ( mine )
        (FDataLink.Field as TBlobField).SaveToStream(s); // ( mine )
        s.Position:= 0; // ( mine )

        if (S=Nil) or (s.Size = 0) then
          begin
          Picture.Clear;
          exit;
          end;
        try
          //GraphExt :=  s.ReadAnsiString; // (lazarus team)
          // gc := GetGraphicClassForFileExtension(GraphExt); // (lazarus
team)
          //  if assigned(gc) then  // (lazarus team)
          //  begin   // (lazarus team)

      Picture.Jpeg.LoadFromStream(s); // ( mine )

      //AGraphic. := gc.Create;  // (lazarus team)
      //AGraphic.LoadFromStream(s);  // (lazarus team)
      //Picture.Assign(AGraphic);
            //end;
        finally
          //if assigned(AGraphic) then AGraphic.Free;  // (lazarus team)
          s.Free;
        end {try}

        end
      else
        Picture.Assign(FDataLink.FField);
      end;
    FUpdatingRecord := False;
    end;
end;
=================================

2008/9/2 Osvaldo TCF - Listas <[EMAIL PROTECTED]>

> With my image: a .jpg file
> ---------------------------
> in dbimage.inc, line 163:
>        try
>          GraphExt := s.ReadAnsiString;
>
>          gc := GetGraphicClassForFileExtension(GraphExt);
>          if assigned(gc) then
>            begin
>            AGraphic := gc.Create;
>            AGraphic.LoadFromStream(s);
>
>            Picture.Assign(AGraphic);
>            end;
> -------------------------------------------
>
> gc is not assigned, is it correct?
> ==========================================================
>
> The AV ocour here:
> dbimage.inc line 175
> ----------------------
>            Picture.Assign(AGraphic);
>            end;
>        finally
> line 175>>  if assigned(AGraphic) then AGraphic.Free;
>          s.Free;
>        end {try}
> ----------------------
>
> Em Ter, 2008-09-02 às 10:34 +0200, Joost van der Sluis escreveu:
> > Op maandag 01-09-2008 om 12:05 uur [tijdzone -0300], schreef Osvaldo
> > Filho:
> > > I can not use tdbimage, access violation!
> > >
> > > loadpicture error?
> >
> > Hmm... I had that working with a few hacks. Maybe that it doesn't work
> > anymore with the latest image changes in Lazarus-svn. So which fpc and
> > lazarus version are you using?
> >
> > Joost
> >
> >
> > _______________________________________________
> > Lazarus mailing list
> > Lazarus@lazarus.freepascal.org
> > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>
_______________________________________________
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to