Question

Displaying an Image from a Link on a Record Page

Hello,

 

I am having issues displaying an image from a link on the record page. I have followed the tutorial below, but have had no success.

 

https://academy.creatio.com/docs/developer/interface_elements/record_pa…

 

The issue seems to be that this tutorial is built to generate links for picture files saved/changed on the record page. Where I would like to do the opposite and display an image from a link that has already been generated elsewhere. The link is from PlantUML and here is an example.

 

www.plantuml.com/plantuml/png/SoWkIImgAStDuNBAJrBGjLDmpCbCJbMmKiX8pSd9v…

 

Is there any functionality to display images from image links generated outside of Creatio?

Like 1

Like

2 comments
Best reply

Hi Dominic, 

 

You can do this with the following steps: 

 

1) Add an attribute to the page:

"MyImage": {
	dataValueType: Terrasoft.DataValueType.TEXT,
	type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
	value: ""
}

2) Then add an ImageView element to the diff bound to that attribute: 

{
	"operation": "insert",
	"name": "MyPageImage",
	"values": {
		"itemType": Terrasoft.ViewItemType.COMPONENT,
		"className": "Terrasoft.ImageView",
		"imageSrc": {
			"bindTo": "MyImage"
		},
		"classes": {
			"wrapClass": [
				"myimage-style"
			]
		}
	},
	"parentName": "MyImageContainer",
	"propertyName": "items",
	"index": 0
}

3) Now, to show a image, all you have to do is set the image URL in the attribute:

this.set("MyImage", "https://someurl/dir/myimage.png");

Ryan

Alright, I have found a temporary solution using the iFrame element. I basically followed the steps in this article here.

 

https://academy.creatio.com/docs/developer/interface_elements/record_pa…

 

I am still convinced there is a better solution than this. Let me know if there is a better built-in solution to displaying image links.

Hi Dominic, 

 

You can do this with the following steps: 

 

1) Add an attribute to the page:

"MyImage": {
	dataValueType: Terrasoft.DataValueType.TEXT,
	type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
	value: ""
}

2) Then add an ImageView element to the diff bound to that attribute: 

{
	"operation": "insert",
	"name": "MyPageImage",
	"values": {
		"itemType": Terrasoft.ViewItemType.COMPONENT,
		"className": "Terrasoft.ImageView",
		"imageSrc": {
			"bindTo": "MyImage"
		},
		"classes": {
			"wrapClass": [
				"myimage-style"
			]
		}
	},
	"parentName": "MyImageContainer",
	"propertyName": "items",
	"index": 0
}

3) Now, to show a image, all you have to do is set the image URL in the attribute:

this.set("MyImage", "https://someurl/dir/myimage.png");

Ryan

Show all comments