Rename image when I link it to the image control

Version: 7.5.5.2 (X86_64) / LibreOffice Community
Build ID: ca8fe7424262805f223b9a2334bc7181abbcbf5e
CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: pt-BR (pt_BR.UTF-8); UI: pt-BR
calc: threaded

I’m creating a database for third-party use, I need the images stored in it to have standardized names, but I can’t leave this task to the end user. I need the images added to the image control in one of the forms (which is linked to a text field in one of the DB tables), to be renamed based on the ID of the photo itself and the ID of the object with which she’s on.

Example: maxresdefault.jpg > after selecting > 1.2.jpg > being 1 the ID of the object and 2 the ID of the photo, that is, there is a photo before this one linked to the same object, being 1.1.jpg.

It would be necessary to have a way to delete these images as well, so that images that are not being used in the database are not stored in the folder. All images are saved in the photos folder, which is inside the database folder, where the .odb file is located, all this to allow portability from one system to another.

I guess you will need a macro for renaming BEFORE you “link” the image to your DB, or renaming will break the link.

If your database already knows the filenames of your images I’d assume you can “find” them easily ??

Can also be done via macro…

1 Like

Thanks for the answer, can you give me more information about these macros? Couldnt find them anywhere

When I try to connect to a image by the image control I could rename the image before inserting it. I press right mouse button here and get this in context menu. Here a screenshot of OpenSUSE with KDE, language is German, “Umbenennen” is “Rename”.


So I won’t need any macro for this…

In my OS this isnt possible, I’m using a different linux version, made specially for my work environment, and Im working on this DB for another user, so, the less they need to do the better for the DB

You will have to write them according to your needs…
Try Andrew Pitonyak “OOME” for OpenOffice Macros explained, Chapter 8 (File Routines) Table 58 File-functions in OO-Basic as reference. Or also 6.1.12 at StarBasic / OpenOffice.org Basic FAQ

Macros can not be found before they are written by someone.