1

Is it possible to dynamically generate an image in Apex? So for example let's say I have 5 background images but need to dynamically display different text on top of the image according to the record being viewed. The text itself will be based on a custom object so ideally I was looking at Apex to avoid anyone having to create a new image every time new text is added.

I thought I had read about a library/class that could do something like this in the past but I've not been able to find it again (maybe I was dreaming...)

Edits: It will be viewed on a VF page, static resources could be used for the background image but not for the dynamic part.

4
  • Do you want to display dynamic static resource image or you want to generate image?
    – Ratan Paul
    Dec 2, 2015 at 12:51
  • Can you do this with css and overlay a div containing the text? Expecting this to be viewed on a VF page... Dec 2, 2015 at 12:54
  • Thanks both, I've added more detail in my question but yes it will be viewed on VF page.
    – Girbot
    Dec 2, 2015 at 13:08
  • 1
    As @RichardDurrant mentioned, can't you use CSS to display text over your dynamically retrieved image form static resource?? Dec 2, 2015 at 13:15

1 Answer 1

0

You can do this with CSS where you use a field to include the text that will display over top of your image using {!field_to_display__c} in the appropriate portion of your CSS. The CSS would need to be included in your page. If you're changing the image at the same time, you could also do that as well. Your question isn't stated clearly enough to know if you want to do both, but field expressions can be used in your CSS.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .