How to embed an image inside an Embedded Form

Hi to all,
I’d like to embed an image inside an Embedded Form.

I tried with

but it doesn’t work.

Thanks
Raf

Hi,
Is your image a static image like a logo, or a dynamic image which may be a process variable? In addition are you using the Spring Boot architecture, or a shared engine?

regards

Rob

Hello Webcyberrob,
my image is static and I’m using a shared engine.

regards,
raf

Hi Raf,

Ok - Im going to use the Camunda Maven servlet archetype. In this structure, you normally have an application name (eg Appx) and a folder structure something like

source/main/webapp/forms

I create a folder below this called /images.

Then in my HTML form, the src path will be

<img src="/Appx/forms/images/blank-person.png">

Hence assuming you deploy on something like Tomcat, the form will reference the Tomcat containers application context (eg Appx).

regards
Rob

Dear Webcyberrob,
thanks again for your answer.

Is there a way I can use an image deployed with the process, instead of
installing it?

I’m using https://docs.camunda.org/manual/7.4/reference/rest/deployment
/post-deployment/
to create new deployments containing both bpmn and html forms. I can deploy images, too. However, I see no way of accessing them or, to get their URL.

Is there a way to do that instead?

regards,
raf

Hi Raf,

if that’s the case, try the REST API. This refernece [1] may be of interest. Hence I would anticipate your html may look like;

<img src="/engine-rest/engine/default/deployment/{id}/resources/{resourceId}/data">

regards

Rob

[1] https://docs.camunda.org/manual/7.9/reference/rest/deployment/get-resource-binary/#method

Thanks for the answer. I considered the “REST API” way; however, I
struggled with the fact that both the deploymentId and the resourceId
are assigned after deployment. This basically means that I can’t refer
to them statically.
If the API was, for example,
GET /deployment/${processName}/resources/${fileName}/data
then that would be easier because those variables are known.

I think there might be a way to get this URL using JS, but I would
prefer to keep it simple, if possible.

Hi,
Yes to be more dynamic, you may have to make three API calls;

Use List and filter by your deployment name to lookup the deployment ID.
Use Resources to get the set of resources associated with the deployment which will give you name and Id of resources.
Thus now you will know the Id of the resource you are after…

regards

Rob

Thanks,
Webcyberrob :slight_smile: