0

I have uploaded image to static resource. i just want to display it on the visual force componet (apex:component) . i tried this way <apex:image id="theImage" value="{!$Resource.myResourceImage}" width="200" height="200"/>. but still image is not rendering in the ui.

Thanks in advance

0

Hello below code is working for me Please try this

<apex:page >
<apex:image value="{!URLFOR($Resource.vfimagetest,'cats/kitten1.jpg')}"/>
</apex:page>
3
  • i have tried this approach already like <apex:image value="{!URLFOR($Resource.track)}"/> but it is not working. here track is static resource file name – DSK Sep 18 '20 at 10:40
  • give the image path also , check my example 'vfimagetest' is my zipped file and after that i gave image path 'cats/kitten1.jpg' , here cat is folder in zip file – Sahil Malhotra Sep 18 '20 at 11:34
  • dont know some how , it is not working in my environment. need to find the alternative way – DSK Sep 18 '20 at 13:20
0

The reason why the image doesn't show up in the email is because value="{!$Resource.myResourceImage}" generates a relative URL from which the image is rendered (i.e. "/resource/1312483024000/logo"). This URL is accessible only for authenticated platform users.

To solve this problem, images should be stored in documents and with "Externally Available Image" checked. The image will be available by using the following markup:

<apex:image id="theImage" value="https://c.<instance>.content.force.com/servlet/servlet.ImageServer?id=<document_id>&oid=<organization_id>" width="200" height="200"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.