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
Nishant Prajapati 10Nishant Prajapati 10 

How to display an image on visualforce page uploaded via Rich text filed of custom object

<apex:page showHeader="false"  controller="Controller004">
<link href='https://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'/>
<style>
h1{font-family: 'Oswald', sans-serif; text-decoration:none;}
</style>
<apex:pageBlock >
<apex:pageBlockSection title="Record of avalaible Doctors">
<apex:form >
<apex:pageBlockTable value="{!obj}" var="a">

 <apex:column headerValue="Name">
 <h1><apex:outputField value="{!a.Full_Name__c}" /></h1>
 </apex:column>
 <apex:column headerValue="Fee">
<h1><apex:outputField value="{!a.Fee__c}"/></h1>
</apex:column>
<apex:column headerValue="Schedule">
<h1><apex:outputField value="{!a.schedule__c}"/></h1>
</apex:column>
<apex:column >
<apex:image value="{!a.ImageUpload__c}" />
</apex:column>
</apex:pageBlockTable>
</apex:form>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
above is code of VF page
and controller of this page is:
global class Controller004{

public List<Doctor__c> obj{get;set;}
public Controller004(){
obj = [select Full_Name__c, Fee__c, schedule__c, ImageUpload__c from Doctor__c];

}
}


 
Best Answer chosen by Nishant Prajapati 10
JyothsnaJyothsna (Salesforce Developers) 
Hi Nishant,

Instead of  <apex:image value="{!a.ImageUpload__c}" /> you can use 

<apex:outputField value="{!a.ImageUpload__c}" /> 

It will display your richText Area image.

Hope this helps you!
Best Regards,
Jyothsna

All Answers

JyothsnaJyothsna (Salesforce Developers) 
Hi Nishant,

Instead of  <apex:image value="{!a.ImageUpload__c}" /> you can use 

<apex:outputField value="{!a.ImageUpload__c}" /> 

It will display your richText Area image.

Hope this helps you!
Best Regards,
Jyothsna
This was selected as the best answer
Nishant Prajapati 10Nishant Prajapati 10
Thank You Jyothsna. It works. But now I face problem on How to give heiight and width to an image in OutPutField. I tried Style and Style class attributes but didn't work.
Hacene CHAOUCHIHacene CHAOUCHI

Hi Nishant,


Same problem here... Did you solve it ?

Thanks,
Hacene

Mamatha R 4Mamatha R 4
Hi @Hacene CHAOUCHI, @Nishant Prajapati 10
Did you figure out any way to style image in OutPutField?