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
Deepak ChouhanDeepak Chouhan 

i want to display image into VF page but it isn't work proper

<apex:repeat value="{!product}" var="p">
            <apex:outputPanel styleClass="panel">
            <apex:image value="{!p.Image__c}"/>   <!--<apex:image url="{!p.Image__c}"/>                     -->
            <apex:outputLabel value="{!p.Product_Name__c}"/>
            <apex:outputLabel value="{!p.Price__c}"/>
            </apex:outputPanel>
 </apex:repeat>
------------------------------------------------
apex:code
------------------------------------------
public PageReference gosearch() {
        product= [ SELECT Image__c,Price__c,Product_Name__c FROM OProduct__c WHERE Product_Type__c like :('%'+search+'%') ];                               
        return null;
    }

    public String search {get;set;}
    public List<OProduct__c> product{set;get;}
PrasanntaPrasannta (Salesforce Developers) 
Hi,

where are your images stored in salesforce?

If it is stored in documents folder, refer the sample code to display the image on VF page-


Controller-

public with sharing class ImageController {
public String imageURL{get;set;}
  
  public ImageController()
  {
    imageURL='/servlet/servlet.FileDownload?file=';
    List< document > documentList=[select name from document where
                                    Name='SamplePic'];
  
    if(documentList.size()>0)
    {
      imageURL=imageURL+documentList[0].id;
    }
  }
}

Vf pafe-

<apex:page controller="ImageController" showheader="false" sidebar="false">

    <apex:form>
      <apex:image url="{!imageURL}">
    </apex:image></apex:form>

</apex:page>

Hope this helps. Kindly mark it as best answer if it works.
Deepak ChouhanDeepak Chouhan
hi,
thanks for reply.
images stored into the custome sobject field.
structure of sobject
------------------------------------------------
sObject  API name : OProduct__c
------------------------------------------------
Product_Name__c : Text
Image__c : Rich Text
Price__c : Currency
PrasanntaPrasannta (Salesforce Developers) 
Hi,

Try using <apex:inputTextArea> instead of <apex:image> on VF page .


Deepak ChouhanDeepak Chouhan
hi,
it isn't working.
Tejpal KumawatTejpal Kumawat
Hello Deepak,

Please can you use :

<apex:outputField value="{!p.Image__c}"/>

Thanks
Tejpal
Deepak ChouhanDeepak Chouhan
Hi Tejpal,
thanks for reply
it is working proper..:)