Saving and loading JPEG from Paradox7 table- Error on load 
Author Message
 Saving and loading JPEG from Paradox7 table- Error on load

Quote:

> I think I have successfully stored a  JPG in a Paradox 7 BLOB field, but I
> can't get the retrieval to work. I am using Delphi4 under NT4 SP3.

> Here is my code for saving a JPG to the BLOB field:

> Try
>         begin
>             tblPic.Edit;
>             TBlobField(tblPic.FieldByName('Pic')).BlobType := ftTypedBinary
> ;

> TBlobField(tblPic.FieldByName('Pic')).LoadFromFile(flbDriveA.Items.Strings[f
> lbDriveA.ItemIndex]);
>         end;
>  Finally
>               tblPic.Post;

>  End;

> My Table is named tblPic and has a valid BLOB field called PIC, flbDriveA is
> a FileListBox pointed at DriveA. I am not sure if setting the field type to
> fTypedBinary is necessary, but it seems to save that way. (I have gone
> through many iterations of this code)
> I Type my field as a TBlobField because it doesnt seem to work if I just try
> to assume that the Field is a BLOB.
> Then I update my DB.

> The database MB file gets larger as I add JPG's but I can't seem to retrieve
> them. Here is my retrieve code:

> Since TDBImage does not support JPG's directly (I don't think it does
> anyway) I am just trying to load the information to a stream and Assign it
> to a TJPGImage. This code came directly from DevelopersHref.com in an
> article by Steve Koterski of Borland but it does not seem to work for me.

> procedure TForm1.tblPicAfterScroll (Dataset:Tdataset);
> var
>     MS: TmemoryStream;
>     J1: TJPEGImage;
> begin
>     J1:= TJPEGImage.create;
>     MS:= TMemoryStream.create;
> try
>     TBlobField(DataSet.FieldByName('Pic')).SaveToStream(MS);
>     MS.Seek(soFromBeginning,0);

>     with J1 do begin
>     PixelFormat:=jf24Bit;
>     Scale := jsFullSize;
>     Grayscale:=False;
>     Performance:=jpBestQuality;
>     ProgressiveDisplay := True;
>     ProgressiveEncoding :=TRUE;
>     LoadFromStream(MS);
>     end;
>     Image1.Picture.Graphic.Assign(J1);
> finally
>     J1.Free;
>     MS.Free;
> end;

> end;

> The above code compiles just fine, but it Barfs on
> Image1.Picture.Graphic.Assign(J1) and gives an access violation at 0048803b.

> Thanks in advance for any help.

> Jason McKnight

  The Image1 component might not be able to assign the J1 variable as it is not
a bitmap try copy rect to a bitmap canvas from the J1 canvas then try assigning
the bitmap.


Wed, 18 Jun 1902 08:00:00 GMT
 Saving and loading JPEG from Paradox7 table- Error on load

I think I have successfully stored a  JPG in a Paradox 7 BLOB field, but I
can't get the retrieval to work. I am using Delphi4 under NT4 SP3.

Here is my code for saving a JPG to the BLOB field:

Try
        begin
            tblPic.Edit;
            TBlobField(tblPic.FieldByName('Pic')).BlobType := ftTypedBinary
;

TBlobField(tblPic.FieldByName('Pic')).LoadFromFile(flbDriveA.Items.Strings[f
lbDriveA.ItemIndex]);
        end;
 Finally
              tblPic.Post;

 End;

My Table is named tblPic and has a valid BLOB field called PIC, flbDriveA is
a FileListBox pointed at DriveA. I am not sure if setting the field type to
fTypedBinary is necessary, but it seems to save that way. (I have gone
through many iterations of this code)
I Type my field as a TBlobField because it doesnt seem to work if I just try
to assume that the Field is a BLOB.
Then I update my DB.

The database MB file gets larger as I add JPG's but I can't seem to retrieve
them. Here is my retrieve code:

Since TDBImage does not support JPG's directly (I don't think it does
anyway) I am just trying to load the information to a stream and Assign it
to a TJPGImage. This code came directly from DevelopersHref.com in an
article by Steve Koterski of Borland but it does not seem to work for me.

procedure TForm1.tblPicAfterScroll (Dataset:Tdataset);
var
    MS: TmemoryStream;
    J1: TJPEGImage;
begin
    J1:= TJPEGImage.create;
    MS:= TMemoryStream.create;
try
    TBlobField(DataSet.FieldByName('Pic')).SaveToStream(MS);
    MS.Seek(soFromBeginning,0);

    with J1 do begin
    PixelFormat:=jf24Bit;
    Scale := jsFullSize;
    Grayscale:=False;
    Performance:=jpBestQuality;
    ProgressiveDisplay := True;
    ProgressiveEncoding :=TRUE;
    LoadFromStream(MS);
    end;
    Image1.Picture.Graphic.Assign(J1);
finally
    J1.Free;
    MS.Free;
end;

end;

The above code compiles just fine, but it Barfs on
Image1.Picture.Graphic.Assign(J1) and gives an access violation at 0048803b.

Thanks in advance for any help.

Jason McKnight



Wed, 18 Jun 1902 08:00:00 GMT
 Saving and loading JPEG from Paradox7 table- Error on load
Hi there,

you might want to try a Image1.Picture.Assign(J1);

maybe that will work.

--
Martijn Tonies
http://surf.to/seal97
(Check the Delphi components page)

<none of the text written above has got anything to do with Euro Partners
Informatici BV>

System Development
Euro Partners Informatici BV
http://www.euro-partners.nl

Jason McKnight heeft geschreven in bericht

Quote:
>I think I have successfully stored a  JPG in a Paradox 7 BLOB field, but I
>can't get the retrieval to work. I am using Delphi4 under NT4 SP3.

>Here is my code for saving a JPG to the BLOB field:

>Try
>        begin
>            tblPic.Edit;
>            TBlobField(tblPic.FieldByName('Pic')).BlobType := ftTypedBinary
>;

>TBlobField(tblPic.FieldByName('Pic')).LoadFromFile(flbDriveA.Items.Strings[
f
>lbDriveA.ItemIndex]);
>        end;
> Finally
>              tblPic.Post;

> End;

>My Table is named tblPic and has a valid BLOB field called PIC, flbDriveA
is
>a FileListBox pointed at DriveA. I am not sure if setting the field type to
>fTypedBinary is necessary, but it seems to save that way. (I have gone
>through many iterations of this code)
>I Type my field as a TBlobField because it doesnt seem to work if I just
try
>to assume that the Field is a BLOB.
>Then I update my DB.

>The database MB file gets larger as I add JPG's but I can't seem to
retrieve
>them. Here is my retrieve code:

>Since TDBImage does not support JPG's directly (I don't think it does
>anyway) I am just trying to load the information to a stream and Assign it
>to a TJPGImage. This code came directly from DevelopersHref.com in an
>article by Steve Koterski of Borland but it does not seem to work for me.

>procedure TForm1.tblPicAfterScroll (Dataset:Tdataset);
>var
>    MS: TmemoryStream;
>    J1: TJPEGImage;
>begin
>    J1:= TJPEGImage.create;
>    MS:= TMemoryStream.create;
>try
>    TBlobField(DataSet.FieldByName('Pic')).SaveToStream(MS);
>    MS.Seek(soFromBeginning,0);

>    with J1 do begin
>    PixelFormat:=jf24Bit;
>    Scale := jsFullSize;
>    Grayscale:=False;
>    Performance:=jpBestQuality;
>    ProgressiveDisplay := True;
>    ProgressiveEncoding :=TRUE;
>    LoadFromStream(MS);
>    end;
>    Image1.Picture.Graphic.Assign(J1);
>finally
>    J1.Free;
>    MS.Free;
>end;

>end;

>The above code compiles just fine, but it Barfs on
>Image1.Picture.Graphic.Assign(J1) and gives an access violation at
0048803b.

>Thanks in advance for any help.

>Jason McKnight



Wed, 18 Jun 1902 08:00:00 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. Load indexed table via parallel direct load?

2. Error loading data via BUTIL -LOAD

3. Cannot load driver error when loading Alias Manager

4. VB6: application in runtime environment with error on loading form: ado cannot load object

5. DTS Error: failed to load or save the package properly

6. How to save JPEG image in MSSQL table?

7. Help needed with saving JPEG images to table

8. Table loading errors

9. load table error

10. Table space access is not allowed DB2 error during LOAD

11. Error message from using DTS loading table.


 
Powered by phpBB® Forum Software