cancel
Showing results for 
Search instead for 
Did you mean: 

Deploy static images

jorge_serrao
Champ in-the-making
Champ in-the-making
Hi,

I'm trying to send an e-mail throughout Activiti and put my company's logo as an image, using HTML.

I deployed a bar files which contains the BPMN processes in src/main/resources/diagrams and the logo in src/main/resources/images.
Once deployed I can see that the image was deployed but I didn't figure how I can access the image.

I tried the following:
<img src='src/main/resources/images/logo.png'> but that didn't work.
Should I implement a listener and query the repository to get the image or there is a simpler way to do it?

Thanks
5 REPLIES 5

jorge_serrao
Champ in-the-making
Champ in-the-making
Sorry I meant I tried <code><img src="src/main/recources/images/logo.png" /></code>

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Jorge,

you can use org.activiti.engine.RepositoryService#getResourceAsStream
Regards
Martin

Hi Martin,

I tried this before but it didn't work.

When I invoke the <code>getResourceAsStream</code> method it will retrieve me a ByteArrayInputStream.
I tried transform the ByteArrayInputStream to a String base 64 and link this to the html img tag but apparently Gmail and Outlook block this way.

Then I decided to link the image to the tag so what I have done was:
1 - Invoke the Activiti Rest API and then linked the content-url to the src of the html image.
It didn't work either.
To workout why it didn't work I invoked the URL on Chrome and and received the bytes back which means the browser didn't rendered the image.

I'm trying to exclude the option of attaching the image into the e-mail and then use HTML to display the image because I would need to implement the functionality.

Do you have any other ideas?

Thanks

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

create simple jUnit test:
  1. create and deploy a deployment with the static image.
  2. ready bytes from the input stream and store them into the file.
  3. check the file content (it should be the same as the deployed static image)
This test should provide you the proof that Repository service is able to store static image in the deployment and provide its content back to you.

Regards
Martin

Hi Martin,

The code seems work, I think that the e-mail client is blocking the image along with the html form.
They might do it due to security issues.

Thanks for your help