Thanks to a good steer in this thread I have managed to get an image into an email template that I can package up and put in any org.
My design:
- Stores the image as a document
- Uses a component with a custom controller
- The controller executes a query and gets the ID of the image and
The Component then displays the image by doing:
<apex:component controller="ImageCustomController" access="global"> <apex:attribute name="height" description="Id for image" type="String"/> <apex:image value="{!LEFT($Api.Partner_Server_URL_140, FIND('.com/',$Api.Partner_Server_URL_140)+3)}/servlet/servlet.ImageServer?id={!ImageId}&oid={!$Organization.Id}" height="{!height}"/> </apex:component>
All brilliant.
However, it is difficult to place something beside my component. In my template, I do:
<div>
<c:ImageComponent height="20"/>
<H1>Performance Insight</H1>
</div>
The image component takes the width of the screen. I want it to behave just like a normal where it is possible to put stuff beside it.
Note: In some cases I want stuff beside and in other cases I won't. So if put the stuff beside it into the actual component I will need to have some logic to know whether to display the extra stuff or not. Is that possible?