Topic: DBImage and script

Hello Dmitry and all MVD fans,


Simple question I'm sure for you :


When I put a DBImage1 on Form1, and run the program, when I load the image, it is saved in Database without problems (Type StoreFile, not LinkFile).


But when I do something like :

HTTPGetFile(MAINIMG, SKU+'-001-main-image.jpg');
asset_add_web_result.DBImage1.Picture.LoadFromFile(SKU+'-001-main-image.jpg');

on running the program the image is correctly displayed in DBImage1, but when I click save, it's not saved into database.


The DBImage1 is linked normally with a table and a field, the SAVE button take into account the DMImage1 field and the correct table like normal, the only difference is that I don't load manually the image into the DBImage1, but I load it with a script.


I think it as to do with the _filename that is added automaticly by MVD to the database when you decide to store the file in database, but that's just a guess.


Any idea ?


Wish you all a good day


Cheers


Mathias

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: DBImage and script

Hello Dmitry and all MVD fans


To illustrate my previous post, here is a little project (last beta requiered for HTTPGetFile)


  • Click the download button to retrieve the file (it is stored in MVD folder under the name test.jpg)

  • Allow a few second for the image to be downloaded and displayed on the right DBImage

  • Load the test.jpg image in the left DBImage

  • Click the left SAVE button

  • Click the right SAVE button


Now if you look into the database (SQLLite studio or equivalent), you'll see the left image is saved, the right one is not.


The only difference is that the left one is loader manually, when the right one is loaded through script.


Can anyone guess why it works in one case and not in the other ?


Cheers


Mathias

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: DBImage and script

Where is the file?

Re: DBImage and script

Stupid me, I forgot to join it smile

Latest beta

Cheers

Math

Post's attachments

Attachment icon DBIMage.zip 3.86 kb, 456 downloads since 2015-11-25 

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: DBImage and script

procedure Form1_load_local_OnClick (Sender: string; var Cancel: boolean);
var
    URL : String;
begin
    URL := 'http://www.daz3d.com/media/catalog/product/cache/1/image/960x1248/17f82f742ffe127f42dca9de82fb58b1/0/0/00-main-actual-eyes-4-daz3d.jpg';
    HTTPGetFile(URL,'test.jpg');

    Form1.DBImage2.Picture.LoadFromFile('test.jpg');
    Form1.DBImage2.dbFileName := 'test.jpg';
end;
Dmitry.

Re: DBImage and script

Hello Dmitry,

Works like a charm, as usual.

I was pretty sure there was something with the name, but I couldn't get my hands on it.

Thanks a million

Cheers

Mathias

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor