Topic: LinkFile problem?

Hi,

I Store images in a "DBImages" object and set the "Type" to 'LinkFile'.
In my application i rename files on disc to a unique filename and then i want to load it in to my "DBImages" object.
When i do this the image displays correctly, but... When i save the form and open it up again, the image is gone..
It works if i set the 'Type' to 'StoreFile'

What am i doing wrong?

Re: LinkFile problem?

Hello.


Please attach your project (zip file without exe and dll) and describe your steps one by one to reproduce this case.

Dmitry.

Re: LinkFile problem?

HI, again

Here is the zip. i Have included a image that hopefully describes what i´m after.
The script on 'Form1.Button5" does the work.

Post's attachments

Attachment icon NE.zip 910.81 kb, 337 downloads since 2019-02-15 

Re: LinkFile problem?

Hi,

I've done some research

If i load the file with the forms OnShow event. The images is loaded but the view function does not work.

With the 'Open' icon on the DBImage1 Object  the image is stored in the database even if i have "DBImage1" "Type" set to "LinkFile", Right?

Is that an explanation why the View function does not work?

Regards

5 (edited by derek 2019-02-18 14:19:52)

Re: LinkFile problem?

Hi Cujos,
Had a quick look at your message.
In answer to your original question -

In my application i rename files on disc to a unique filename and then i want to load it in to my "DBImages" object.
When i do this the image displays correctly, but... When i save the form and open it up again, the image is gone..

This is because when you use the linkfile option, it stores the path+file name in a field (in your example - main_table.bild_filename).  If you then rename the file as you are doing, you need to update main_table.bild_filename at the same time otherwise MVD can't find the image.
If you didn't need to rename the file, it would be very simple, using the 'copyto' object property of dbimage1.
But if it is a requirement to choose an image from the source folder, copy the image to another location, rename the image and then delete the image from the souce folder, I would perhaps do it like this (see attached);  obviously, you will need to change a couple of things in the script where I have hard-coding pathnames (I was in a hurry!) but the approach should work for you.
Hopefully, it will give you a few ideas,
Derek.

Post's attachments

Attachment icon renamedelete.zip 338.17 kb, 373 downloads since 2019-02-18 

6 (edited by derek 2019-02-18 14:29:20)

Re: LinkFile problem?

Hi Again,
Forgot to mention that you will also need to change the 'copyto' object property of dbimage1 to your own choice of folder.
Derek.

Re: LinkFile problem?

Hi, Derek

Thank´s for your answer.

I store the filename in my table. So i use it to load the image on "Form1_OnShow" event. It works fine.

The viewer problem i solved with a "zoom" -button calling up an external viewer for my image.

Cujos