Dear All,
Please advice me
How To Insert Image File Into MySQL Blob Filed In Delphi 7 Coding.
I am saving image into PostgreSQL bytea field through this coding.Its work fine tablenamne.FieldByName('byteafiled') .LoadFromFile('c:\temp.jpg');
When i use this coding MySQL blob means.I am getting Error
Einvalid Graphic With Message Bitmap Image Is Invalid like this.
For database connection and query i am using Zeos Access Component.Please help me.How to solve this problem.Advance thanks to all.
Thanks & Regards
Siva
Reg How To Insert Image File Into MySQL Blob Filed In Delphi
Moderators: gto, cipto_kh, EgonHugeist
-
- Fresh Boarder
- Posts: 17
- Joined: 28.05.2007, 14:31
Hi varathasiva ..
In MySQL you may used LONGBLOB instead BLOB data type.
for the saving image you may try this :
Hopefully work, but you may not use at Delphi 2009 with Zeos 7 beta version, because this would be JPEG Error maybe Bad Format.
Thanks
Man'z
In MySQL you may used LONGBLOB instead BLOB data type.
for the saving image you may try this :
Code: Select all
var
J: TJPEGImage;
begin
J := TJPEGImage.Create;
J.LoadFromFile('C:\Manz\Projects\Web\hrms\public_html\images\photo\1357a.jpg');
zTable2.Active := true;
ztable2.Append;
ztable2.FieldByName('foto').Assign(J);
ztable2.Post;
FreeAndNil(J);
end;
Thanks
Man'z
-
- Fresh Boarder
- Posts: 17
- Joined: 28.05.2007, 14:31
Dear Man'z,
Thanks for your quick repy.
I am using same code wht u sent to me.
var
J: TJPEGImage;
begin
if OpenPictureDialog1.Execute then
begin
J.LoadFromFile('c:\temp\ok1.jpg');
student.FieldByName('stu_photo').Assign(J);
student.Post;
FreeAndNil(J);
end;
end;
When i complier comes this line
J.LoadFromFile('c:\temp\ok1.jpg');
Its showing Access Violation Error.Please help me.How to solve this problem.
Im waiting for ur reply.Advance Thanks to u.
Thanks & Regards
Varathasiva
Thanks for your quick repy.
I am using same code wht u sent to me.
var
J: TJPEGImage;
begin
if OpenPictureDialog1.Execute then
begin
J.LoadFromFile('c:\temp\ok1.jpg');
student.FieldByName('stu_photo').Assign(J);
student.Post;
FreeAndNil(J);
end;
end;
When i complier comes this line
J.LoadFromFile('c:\temp\ok1.jpg');
Its showing Access Violation Error.Please help me.How to solve this problem.
Im waiting for ur reply.Advance Thanks to u.
Thanks & Regards
Varathasiva