Converting from/to BLOB
Posted: 2009-10-02T10:58:16-07:00
Hello again
After long tinkering with the VBS ArrayTest example, I can't achieve what i'm trying to do ...
The thing is that in VBS all variables are quite loosely typed, which is not the case in let's say Delphi (which only importants standard windows com types).
I have a variable which contains an image (or pdf) as a simple byte array (read from DB). I know there are ImageFromBlob functions but those are not available via COM+.
I just want to use a simple convert/resize on that image data and save it to a file. (or even better to another byte array).
I tried various things in Delphi and no luck so far ... The code is roughly this
if I replace cmd[0] := src; by cmd[0] := 'logo:'; it works though ...
Any ideas how to achieve this simple thing please ?
Help very much appreciated
After long tinkering with the VBS ArrayTest example, I can't achieve what i'm trying to do ...
The thing is that in VBS all variables are quite loosely typed, which is not the case in let's say Delphi (which only importants standard windows com types).
I have a variable which contains an image (or pdf) as a simple byte array (read from DB). I know there are ImageFromBlob functions but those are not available via COM+.
I just want to use a simple convert/resize on that image data and save it to a file. (or even better to another byte array).
I tried various things in Delphi and no luck so far ... The code is roughly this
Code: Select all
var
cmd, src : Variant;
Params : PSafeArray;
Source : RawByteString; // image byte array in here
...
cmd := VarArrayCreate([0,5], varVariant);
src := VarArrayCreate([0,1], varVariant);
src[0] := 'JPG:';
src[0] := Source;
cmd[0] := src;
cmd[1] := '-resize';
cmd[2] := '200x200';
cmd[3] := 'PNG24:';
cmd[4] := DestPath; // destination file
Params := PSafeArray(TVarData(cmd).VArray);
Img.Convert(Params);
Any ideas how to achieve this simple thing please ?
Help very much appreciated