Re: [lazarus] Image from SQL

2007-05-16 Thread A.J. Venter
Okay guys, It's working. Thanks SO much to everyone who helped me get it going - the final one (it turns out) had nothing to do with the base64 code - while I was restructuring for the idea of saveing as I decode I had to change GetData function - and I forgot to return the result -the files were

Re: [lazarus] Image from SQL

2007-05-16 Thread A.J. Venter
Hiya Bram Well I decided to follow your advice. I changed my structure to encode straight from file (using a tfilestream) and also to decode directly TO a file (completely removing the stringlists). But now my files just remain empty - despite me being very carefull to free the tfilestream... isn

Re: [lazarus] Image from SQL

2007-05-16 Thread A.J. Venter
Just some more on this - I have no upgraded to the 2.3.1 snapshot, The test program still fails - but I did another test, and indeed, xpm format works, - png does not, comparing a head -n 5 on the source and the decoded files show clear differences - though I am not sure what the pattern would be.

Re: [lazarus] Image from SQL

2007-05-16 Thread Bram Kuijvenhoven
A.J. Venter wrote: Var S1,S2,S3: TStringList; FN : String; begin S1 := TStringList.Create; S2 := TStringList.Create; S3 := TStringList.Create; If OpenPictureDialog1.Execute then Begin S1.LoadFromFile(OpenPictureDialog1.FileName); S2.Add(EncodeB64(S1.Text)); S3.A

Re: [lazarus] Image from SQL

2007-05-16 Thread A.J. Venter
I am using version 2.0.4 at this point - should I upgrade ? I did a program as you suggested. It did confirm that it's NOT the database which is at fault. And my testdata is attached, yah.png is the source image I tested with, blah.tmp is the one that was generated (and doesn't open). The pro

Re: [lazarus] Image from SQL

2007-05-16 Thread Bram Kuijvenhoven
Hi A.J., If you create a standalone demo program that: - reads in an image file - calls your Base64Encode function - next calls your Base64Decode function (i.e. leave out the DB stuff) - writes the result to an output file (which is damaged) and attach the image file, then I will take a look at i

RE: [lazarus] Image from SQL

2007-05-16 Thread Sergio Samayoa
. Regards. -Mensaje original- De: A.J. Venter [mailto:[EMAIL PROTECTED] Enviado el: MiƩrcoles, 16 de Mayo de 2007 01:08 p.m. Para: lazarus@miraclec.com Asunto: Re: [lazarus] Image from SQL So - second attempt at implementing it... same sad result - only now the XPM fails as well... This

Re: [lazarus] Image from SQL

2007-05-16 Thread A.J. Venter
I am using it- only I am not apparently using it RIGHT :S My b64decode function is using BASE64's stream class to operate with -it's purpose isn't to do the decoding (BASE64 is meant to do that), but rather the conversion process from string to stream -into base64 - back into string. Since the onl

Re: [lazarus] Image from SQL

2007-05-16 Thread ik
Hi, Why not to use the FPC's unit of BASE64 ? it works on streams. Or am I missing something ? Ido On 5/16/07, A.J. Venter <[EMAIL PROTECTED]> wrote: So - second attempt at implementing it... same sad result - only now the XPM fails as well... This is my now somewhat improved code... am I mis

Re: [lazarus] Image from SQL

2007-05-16 Thread A.J. Venter
So - second attempt at implementing it... same sad result - only now the XPM fails as well... This is my now somewhat improved code... am I missing something extremely obvious here ? Function DecodeB64(S : String) : String; Procedure doNothing; Begin end; var b64decoder: TBase64DecodingStream;

Re: [lazarus] Image from SQL

2007-05-16 Thread A.J. Venter
A small update - Don't ask me WHY - but get this - I take the exact same unchanged code, and insert an XPM image. It works perfectly. I try a jpg or a png - and it fails. All I can imagine is that my b64decode function is broken - and that the breakage is ONLY affecting true binary sources, XPM (

Re: [lazarus] Image from SQL

2007-05-16 Thread A.J. Venter
Hi again all Based on everyone's advice, I chose to go with base64 encoding - and started coding. Right now I am quite successfully: 1) Reading the image 2) Encoding it to base64 (using the encodeb64 function from the examples) 3) Storing the result in the database (I THINK it's storing right) L

RE: [lazarus] Image from SQL

2007-05-16 Thread Sergio Samayoa
> Oh, after I finished copy the backup the HD crashed, So you can see Bottom line: Your own experience with that event and the problems you have particularly with MySQL is why you use such approach. That's ok IF HE/SHE use such database (MySQL) and has the same scenario, otherwise "use the hammer

Re: [lazarus] Image from SQL

2007-05-16 Thread ik
On 5/16/07, Michael Van Canneyt <[EMAIL PROTECTED]> wrote: On Wed, 16 May 2007, ik wrote: > On 5/16/07, Graeme Geldenhuys <[EMAIL PROTECTED]> wrote: > > What DBMS where you using? Firebird has no such issue. I store loads > > of PNG and JPG images in binary Blob fields. Backup and Restore wor

Re: [lazarus] Image from SQL

2007-05-16 Thread Michael Van Canneyt
On Wed, 16 May 2007, Graeme Geldenhuys wrote: > On 5/16/07, Michael Van Canneyt <[EMAIL PROTECTED]> wrote: > > > > > > At my current work I'm working with MySQL clusters that the only way > > > to backup the data is by having sql dump. > > > > Unfortunately MySQL also generates "wrong" sql dumps

Re: [lazarus] Image from SQL

2007-05-16 Thread Micha Nelissen
Graeme Geldenhuys wrote: > Maybe you guys should switch to a *real* DBMS like Firebird. ;-) > [...he ducks and runs for cover...] Or TDbf. Backing up is *sooo* straightforward. Binary data in dBase IV and up is also very straightforward in memos. ;-) (Although lately the memo code seems to be br

Re: [lazarus] Image from SQL

2007-05-16 Thread Graeme Geldenhuys
On 5/16/07, Michael Van Canneyt <[EMAIL PROTECTED]> wrote: > > At my current work I'm working with MySQL clusters that the only way > to backup the data is by having sql dump. Unfortunately MySQL also generates "wrong" sql dumps at times. I learned that very quickly with the above rule... May

Re: [lazarus] Image from SQL

2007-05-16 Thread Michael Van Canneyt
On Wed, 16 May 2007, ik wrote: > On 5/16/07, Graeme Geldenhuys <[EMAIL PROTECTED]> wrote: > > What DBMS where you using? Firebird has no such issue. I store loads > > of PNG and JPG images in binary Blob fields. Backup and Restore works > > perfectly. > > I used Interbase 6.1. The problem was

Re: [lazarus] Image from SQL

2007-05-16 Thread ik
On 5/16/07, Graeme Geldenhuys <[EMAIL PROTECTED]> wrote: What DBMS where you using? Firebird has no such issue. I store loads of PNG and JPG images in binary Blob fields. Backup and Restore works perfectly. I used Interbase 6.1. The problem was that gbak created a corrupted backup file, that w

Re: [lazarus] Image from SQL

2007-05-15 Thread Graeme Geldenhuys
On 5/15/07, Joost van der Sluis <[EMAIL PROTECTED]> wrote: So no need for any string-conversions. Just use: I agree! TImage.LoadFromStream(Dataset.CreateBlobStream(Field,bmread)); I use the FBLib components for a Firebird database in do the same thing. -- Graeme Geldenhuys General erro

Re: [lazarus] Image from SQL

2007-05-15 Thread Graeme Geldenhuys
What DBMS where you using? Firebird has no such issue. I store loads of PNG and JPG images in binary Blob fields. Backup and Restore works perfectly. Graeme. On 5/15/07, ik <[EMAIL PROTECTED]> wrote: Many of the database backup and restore tools backup the data as sql dump. The binary image c

Re: [lazarus] Image from SQL

2007-05-15 Thread Bram Kuijvenhoven
A.J. Venter wrote: This brings up a few questions though: 1) How can I store a string into a TMemoryStream ? I know that TStringList has a loadFromStream method - but how d I go the other way around ? Take a look at TStringStream if you want a stream operating on a string. For the purpose of s

RE: [lazarus] Image from SQL

2007-05-15 Thread Sergio Samayoa
> I guess you have a lot of time and a lot of bandwith, No, I use my time wisely: I always look for better way of doing thing. And yes, in the company I work we have 2 ADSL 1Mbit Internet connections, 4Mbit connection to our main customer network and I have 768Kbit ADSL in my house. > and never

Re: [lazarus] Image from SQL

2007-05-15 Thread Felipe Monteiro de Carvalho
On 5/15/07, ik <[EMAIL PROTECTED]> wrote: so please gain some experience in real life before jumping on things. Both of you (ik and Sergio), please don't use agressive language. We are a friendly community and this has no place here. And "he started" is no excuse =) thanks, -- Felipe Monteiro

Re: [lazarus] Image from SQL

2007-05-15 Thread ik
- De: ik [mailto:[EMAIL PROTECTED] Enviado el: Martes, 15 de Mayo de 2007 10:47 a.m. Para: lazarus@miraclec.com Asunto: Re: [lazarus] Image from SQL On 5/15/07, Joost van der Sluis <[EMAIL PROTECTED]> wrote: > Just use a decent backup, and not a generated sql-script. Amm.. that's

RE: [lazarus] Image from SQL

2007-05-15 Thread Sergio Samayoa
lto:[EMAIL PROTECTED] Enviado el: Martes, 15 de Mayo de 2007 10:47 a.m. Para: lazarus@miraclec.com Asunto: Re: [lazarus] Image from SQL On 5/15/07, Joost van der Sluis <[EMAIL PROTECTED]> wrote: > Just use a decent backup, and not a generated sql-script. Amm.. that's what the bac

Re: [lazarus] Image from SQL

2007-05-15 Thread ik
> > > Database's software must provide backup & restore utilities which can handle > > binary data. > > > > -Mensaje original- > > De: ik [mailto:[EMAIL PROTECTED] > > Enviado el: Martes, 15 de Mayo de 2007 07:32 a.m. > > Para: lazarus@miracl

RE: [lazarus] Image from SQL

2007-05-15 Thread Sergio Samayoa
Take the words from my mouth. -Mensaje original- De: Joost van der Sluis [mailto:[EMAIL PROTECTED] Enviado el: Martes, 15 de Mayo de 2007 08:59 a.m. Para: lazarus@miraclec.com Asunto: Re: [lazarus] Image from SQL Just use a decent backup, and not a generated sql-script. On Tue, 2007-05

Re: [lazarus] Image from SQL

2007-05-15 Thread Joost van der Sluis
On Tue, 2007-05-15 at 13:15 +0200, A.J. Venter wrote: > Hi all, > I would like to be able to store images inside a postgresql table > (inserted WITH a lazarus app) then retrieve them again and display > them from inside a different lazarus app. > XPM would do, but jpg would be ideal. > > I am gues

Re: [lazarus] Image from SQL

2007-05-15 Thread Joost van der Sluis
software must provide backup & restore utilities which can handle > > binary data. > > > > -Mensaje original- > > De: ik [mailto:[EMAIL PROTECTED] > > Enviado el: Martes, 15 de Mayo de 2007 07:32 a.m. > > Para: lazarus@miraclec.com > > Asunto:

Re: [lazarus] Image from SQL

2007-05-15 Thread ik
o de 2007 07:32 a.m. Para: lazarus@miraclec.com Asunto: Re: [lazarus] Image from SQL Hi, You are looking for blob. I recommand you to store the image a base64 on a text blob rathet then a binary blob. The reason is simple.. backup and restore of data. Ido On 5/15/07, A.J. Venter <[EMAIL PROTECTED]

RE: [lazarus] Image from SQL

2007-05-15 Thread Sergio Samayoa
Why text? Database's software must provide backup & restore utilities which can handle binary data. -Mensaje original- De: ik [mailto:[EMAIL PROTECTED] Enviado el: Martes, 15 de Mayo de 2007 07:32 a.m. Para: lazarus@miraclec.com Asunto: Re: [lazarus] Image from SQL Hi, You ar

Re: [lazarus] Image from SQL

2007-05-15 Thread ik
Hi, You are looking for blob. I recommand you to store the image a base64 on a text blob rathet then a binary blob. The reason is simple.. backup and restore of data. Ido On 5/15/07, A.J. Venter <[EMAIL PROTECTED]> wrote: Hi all, I would like to be able to store images inside a postgresql tabl

[lazarus] Image from SQL

2007-05-15 Thread A.J. Venter
Hi all, I would like to be able to store images inside a postgresql table (inserted WITH a lazarus app) then retrieve them again and display them from inside a different lazarus app. XPM would do, but jpg would be ideal. I am guessing the process would be something like this: Inserting an image: