I have preview page and pass Id in url its show break image not showing proper image this is my class code
Public Class displayImageExtension {
String recId;
public displayImageExtension(ApexPages.StandardController controller) {
recId = controller.getId();
}
public String getFileId() {
String fileId = '';
List<Attachment> attachedFiles = [select Id from Attachment where parentId =:recId order By LastModifiedDate DESC limit 1];
if( attachedFiles != null && attachedFiles.size() > 0 ) {
fileId = attachedFiles[0].Id;
}
return fileId;
}
}
this is my page code
<apex:page standardController="Account" extensions="displayImageExtension">
<apex:form>
<apex:image url="{!URLFOR($Action.Attachment.Download,FileId" />
</apex:form>
<apex:page>
url="{!URLFOR($Action.Attachment.Download,FileId"
should beurl="{!URLFOR($Action.Attachment.Download,FileId)}"
. You may want to try resolving this issue.URLFOR
you are currently using?