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
cnp_nareshcnp_naresh 

How to get rich textarea image in apex class

HI everybody,

 

     Can anybody please help me with below query.

 

     I have a custom object and rich textarea field in that. I uploaded a image in that rich textarea field and saved the record.

Now I want to retrieve this image in apex. I used

 

  CustomObject__c img=[select Id,Name,richtextareaimage__c from CustomObject__c];

  string imagvar=img.richtextareaimage__c;

 

   Here I am getting string only not the image.I tried with blob datatype also.its aslo not working.How can I get the image in apex.and print that variable in visualforce.

 

    If you need any other information please let me know.

 

Thanks,

Naresh B

ashish raiashish rai

Hello,

You will get a string when you use this:

 

 CustomObject__c img=[select Id,Name,richtextareaimage__c from CustomObject__c];

 string imagvar=img.richtextareaimage__c;

 

imagvar will contain value like  this:

<img src="https://c.ap1.content.force.com/servlet/rtaImage?eid=00390000008161s&amp;feoid=00N90000002jmDE&amp;refid=0EM9000000003Jk" alt="User-added image"></img>

 

Now you have to use that img src part inside the <apex:image url="Put the Src Part here"> and now you willbe able to find that image.

Saravanan @CreationSaravanan @Creation

hi,

 

 

Could you please tell me how to get only the source url