Hi I have recently begun receiving a jpeg error #53 on the following code since moving from Delphi 7 to 2005
try with DataAccess.dt_Settings do begin Company_Picture := TJpegImage.Create; BlobField := FieldByName('Company_Picture'); BS := CreateBlobStream(BlobField,bmRead); BS.Seek(JpegStartsInBlob(DataAccess.dt_SettingsCompany_Picture), soFromBeginning); Company_Picture.LoadFromStream(BS); //actual line that gives the error end; finally BS.Free; end; frm_rep_PO.QRImage_Company_Picture.Picture.Graphic:=Company_Picture; function JpegStartsInBlob(PicField:TBlobField):integer; var bS : TStream; buffer : Word; hx : string; begin Result := -1; bS := DataAccess.dt_Settings.CreateBlobStream(PicField, bmRead); try while (Result = -1) and (bS.Position + 1 < bS.Size) do begin bS.ReadBuffer(buffer, 1); hx:=IntToHex(buffer,2); if hx = 'FF' then begin bS.ReadBuffer(buffer, 1); hx:=IntToHex(buffer,2); if hx = 'D8' then Result := bS.Position - 2 else if hx = 'FF' then bS.Position := bS.Position-1; end; end; finally bS.Free end; end; It doesn't always happen but it does happen a lot. I have tried different images as well. Any help would be appreciated