function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Greg Brown 4Greg Brown 4 

Display Feed Attachment in VF page

Hi,

I have created a VF page for a custom object that will display pictures at the top of the page.  I'm able to get regular attachments to display when uploaded from the Notes & Attachments related list on the object, but a picture that is uploaded through the Chatter Feed is not displayed.  I noticed that the Attachment Type is different for Chatter Feed Attachments "Feed Attachment".  Can someone advise how I can include the Feed Attachment types in my VF Page.  I'm missing something, my code is below...
Thanks in advance!
Greg
 
VF Page
<apex:page standardController="Acquisition_Report__c" extensions="AcqusitionReportControllerExtension">

<!-- <chatter:feed showPublisher="true" entityId="{!Acquisition_Report__c.id}"/>  -->

    <apex:pageBlock >
        <apex:pageBlockSection title="Photos ({!totalPhotos})" collapsible="false">
            <apex:repeat value="{!photos}" var="photo">
                <apex:image url="{!URLFOR($Action.Attachment.Download, photo)}" height="100" width="150" />                   
            </apex:repeat>
              
        </apex:pageBlockSection>
     
      
        <apex:detail inlineEdit="true"/>
    </apex:pageBlock>


</apex:page>
 
Extension Code

public with sharing class AcqusitionReportControllerExtension {
 
    private ApexPages.standardController controller;
     
    private Acquisition_Report__c acquisition;
 
    private List<Id> photoIds;
 
    public AcqusitionReportControllerExtension(ApexPages.StandardController controller) {
        this.controller = controller;
         
        this.acquisition = (Acquisition_Report__c)controller.getRecord();
    }
 
    public List<Id> photos {
        get {
            if(photoIds == null) {
                photoIds = new List<Id>();
                for(Attachment att : [select Id from Attachment where ParentId  = :acquisition.Id]) {
                    photoIds.Add(att.Id);
                }
            }
                             
            return photoIds;
        }
    }
     
    public Integer totalPhotos {
        get {
            return photos.size();
        }
    }
}