Returns a URI of the Image object that can be interpreted by other layers or components of the generated application.
Image object defined inside the Knowledge Base.
Objects: Image object
.NET, Java, Android, Apple
The returned string is a URI in the form of 'gximage://<image name>', where image name is the Qualified Name of an Image object.
This method is especially – and not exclusively – useful when you need to assign a reference of an Image Object to a variable, and that Image varies by Style, Language, Density, Layer, or Design System Options in runtime.
The client side of the applications may need to show the right image depending on the context information (ie: Design System option Dark or Light) and this context may not be available in every layer of the application. So, when you need to get a reference of the image in a moment or layer where not all the context information is available, this method is useful.
In those scenarios, the use of this method will provide better results than the use of the FromImage method or Link method.
Suppose GeneXusLogo is an image that varies by Design System Tokens Options Dark and Light and you want to show the corresponding in the UI Control &MyImage, depending on the context.
In that case, program the following:
&MyImage.ImageURI = image:GeneXusLogo.GetInternalURI()
A variation of this case in a scenario with a Data Provider object, could be the following:
Create a Data provider called 'GetLogo' that returns an SDT with a 'Logo' item
ImageUri = image:GeneXusLogo.GetInternalURI()
And then use that in a Panel
&SDTLogo = &GetLogo()
&MyImage.ImageURI = &SDTLogo.Logo