You need to sign in to do that
Don't have an account?

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;}
<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;}
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.
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
Try using <apex:inputTextArea> instead of <apex:image> on VF page .
it isn't working.
Please can you use :
<apex:outputField value="{!p.Image__c}"/>
Thanks
Tejpal
thanks for reply
it is working proper..:)