error in select longblob
Posted: 08.10.2009, 14:16
I use Delphi 2010 to save a JPG image into a field LONGBLOB, but after saving in a Mysql the Image is saved only BINARY. When I retrieve the image with "SELECT" error occurs "JPG ERROR # 53". Does anyone know why?
I try this 2 codes to post image is:
1 =
jpg:=TJPEGImage.Create;
jpg.LoadFromFile('fototemporaria.jpg');
b:=TMemoryStream.Create;
jpg.SaveToStream(b);
dataModule1.zqueryprod.ParamByName('foto').SetBlobData(b.Memory,b.Size);
FreeAndNil(jpg);
FreeAndNil(b);
2 =
datamodule1.zqueryProd.ParamByName('foto').LoadFromFile ('fototemporaria.jpg',ftBlob);
and this code to save image is:
jpg:=TJPEGImage.Create;
(datamodule1.zqueryProdprod_foto as TBlobField).SaveToStream(b);
b.Position:=offsetmemorystream;
jpg.LoadFromStream(b);
JPg.SaveToFile(ChangeFileExt('fototemporaria','.jpg'));
(ERROR JPG ERROR #53)
P.S. In Delphi 2006 it worked correctly.
Rodrigo Andrade de Oliveira
I try this 2 codes to post image is:
1 =
jpg:=TJPEGImage.Create;
jpg.LoadFromFile('fototemporaria.jpg');
b:=TMemoryStream.Create;
jpg.SaveToStream(b);
dataModule1.zqueryprod.ParamByName('foto').SetBlobData(b.Memory,b.Size);
FreeAndNil(jpg);
FreeAndNil(b);
2 =
datamodule1.zqueryProd.ParamByName('foto').LoadFromFile ('fototemporaria.jpg',ftBlob);
and this code to save image is:
jpg:=TJPEGImage.Create;
(datamodule1.zqueryProdprod_foto as TBlobField).SaveToStream(b);
b.Position:=offsetmemorystream;
jpg.LoadFromStream(b);
JPg.SaveToFile(ChangeFileExt('fototemporaria','.jpg'));
(ERROR JPG ERROR #53)
P.S. In Delphi 2006 it worked correctly.
Rodrigo Andrade de Oliveira