Open image pop up LO base

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

Sup, I got a request to create a form, with an image control, the images in this control are stored all in one table column, just different registers. I need a way to the image control to pop up the current image, so the user can see the details better, is this something that can be done, or I would need to have some big knowledge on programming?

This is a flexible request, but it would be better if I could do it.

Better do not store the images in the database, particularly not in an embedded database. Base has a memory problem with database images. Store file names of pictures relative to the database document.
A form’s picture control bound to the file name column will show the picture as well. A comparatively simple macro can open the picture in the default viewer of the operating system.

1 Like

The images are already being storaged in a text column, so the size of the DB is normal, thanks for the concerning.

Thats exactly what I need actually, can you give me some more information about this macro?

Here a macro, which starts from a button. In additional information of the button is saved the name of the image control. Image control is bound to a URL.

SUB ShowImage(oEvent AS OBJECT)
	DIM oDoc AS OBJECT
	DIM oForm AS OBJECT
	DIM oField AS OBJECT
	DIM oShell AS OBJECT
	DIM stUrl AS STRING
	DIM stField AS STRING
	DIM arUrl_Start()
	oDoc = thisComponent
	oButton = oEvent.Source.Model
	stImageControl = oButton.Tag
	oForm = oButton.Parent
	oField = oForm.getByName(stImageControl)
	stUrl = oField.BoundField.getString
	IF stUrl <> "" THEN
		arUrl_Start = split(oDoc.Parent.Url,right(convertToUrl(oDoc.Parent.Title),len(convertToUrl(oDoc.Parent.Title))-8))
		oShell = createUnoService("com.sun.star.system.SystemShellExecute")
		stField = convertToUrl(arUrl_Start(0) + stUrl)
		oShell.execute(stField,,0)
	END IF
END SUB

Is there something I need to change in the macro? I’m having some trouble implementing it

Assign it to the execute event of some push button. The button should belong to the same logical form as the image control.

1 Like

It works, thanks