Einzelnen Beitrag anzeigen

calikey

Registriert seit: 19. Mär 2015
29 Beiträge
 
Delphi XE7 Architect
 
#51

AW: JPG im Blob Feld wird extrem groß

  Alt 18. Apr 2015, 17:06
ok der hinweis ist weg danke

nur leider wird immer noch nichts gespeichert.
im debugger steht folgendes.
Delphi-Quellcode:
procedure TBlobField.SaveToFile(const FileName: string);
var
  Stream: TStream;
begin
  Stream := TFileStream.Create(FileName, fmCreate);
  try
    SaveToStream(Stream);
  finally
    Stream.Free;
  end;
end;

procedure TBlobField.SaveToStream(Stream: TStream);
var
  BlobStream: TStream;
begin
  BlobStream := DataSet.CreateBlobStream(Self, bmRead);
  try
    Stream.CopyFrom(BlobStream, 0);
  finally
    BlobStream.Free;
  end;
end;

procedure TBlobField.SaveToStrings(Strings: TStrings);
var
  BlobStream: TStream;
begin
  BlobStream := DataSet.CreateBlobStream(Self, bmRead);
  try
    if DataType = ftWideMemo then
      Strings.LoadFromStream(BlobStream, TEncoding.Unicode)
    else
      Strings.LoadFromStream(BlobStream);
  finally
    BlobStream.Free;
  end;
end;

procedure TBlobField.SaveToStreamPersist(StreamPersist: IStreamPersist);
var
  BlobStream: TStream;
  Size: Longint;
  Header: TBytes;
  GraphicHeader: TGraphicHeader;
begin
  BlobStream := DataSet.CreateBlobStream(Self, bmRead);
  try
    Size := BlobStream.Size;
    if Size >= SizeOf(TGraphicHeader) then
    begin
      SetLength(Header, SizeOf(TGraphicHeader));
      BlobStream.Read(Header, 0, Length(Header));
      Move(Header[0], GraphicHeader, SizeOf(TGraphicHeader));
      if (GraphicHeader.Count <> 1) or (GraphicHeader.HType <> $0100) or
        (GraphicHeader.Size <> Size - SizeOf(GraphicHeader)) then
        BlobStream.Position := 0;
    end;
    StreamPersist.LoadFromStream(BlobStream);
  finally
    BlobStream.Free;
  end;
end;
  Mit Zitat antworten Zitat