+ Start a Discussion
Maxi SMaxi S 

How to display image present in notes & attachment related list using VF page

1) Created one custom object
2) Addded one image file under Notes & Attachment related list
3) Want to display this image in visual force page
Maxi - Follow the below steps and code sample for displaying attachment image in the Visualforce page.

1. Get the Attachment record ID and append in this URL - /servlet/servlet.FileDownload?file= 
2. Use that url string in the visualforce <apex:image> tag to disaply the image in visualforce page

Apex Controller Class:
public with sharing class ImageController {
 public String imageURL{get;set;}
  public ImageController()
    List< Attachment> AttachmentList=[select Id from Attachment where Name='sample.PNG'];

Visualforce Page:
<apex:page controller="ImageController" showheader="true" sidebar="true">
 <apex:form >
      <apex:image url="{!imageURL}">


Maxi SMaxi S
Thanks much Virendra & Karanraj !!