• SINUHE GARCIA MARTINEZ
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hi,

 I want to display an image from attached file on vf page.

 

//vf

<apex:page standardController="stdCust_obj__c" extensions="displayImageExtension">
<table><tr>
<td><h1>Photo:</h1></td>
<td>
<apex:image url="/servlet/servlet.FileDownload?file=file.Id"/>
</td>
</tr>
</table>
</apex:page>

 

//apex

 

public class displayImageExtension {

private id StCustId;
List<Attachment> file;

 

public displayImageExtension(ApexPages.StandardController stdController) {
this.StCustId = ApexPages.currentPage().getParameters().get('id');
}

public List<Attachment> getfile(){

file=[Select Id,Name,LastModifiedDate from attachment where ParentId=:StCustId];
return file; 
}

 

}

 

Thanks in advance.

  • July 20, 2013
  • Like
  • 0