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
Soumya sri yaravaSoumya sri yarava 

how to pass the base64 values form html image tag to the javascript , and frm javascript to the controller

<img id="companyimage" src="data:image/png;base64,iVBORoC/IERYN;CEIHNFEIERCEIRENFA3xOA5Fv4==">
how to get image value as from above tag: iVBORoC/IERYN;CEIHNFEIERCEIRENFA3xOA5Fv4==
instead of  apex:inputfile, iam using the html image tab , for the  render attribute ,

how can i get the base 64value in the , frm the image tag, if iam calling the image value, iam getting the imagename.png in the javascript.

note:here this scenario not to use the apex:inputfile tag  as iam using the rerender attribute..

thanks 
soumya.
AnudeepAnudeep (Salesforce Developers) 
Hi Soumya, 

See this example in the documentation where base64 value is used in the controller
<apex:page controller="ViewImage" cache="true">
      <img src="data:{!att.ContentType};base64,{!image}" /> </apex:page>

public class ViewImage {
      public Attachment att {
            get {
                  if (att == null) {
                        String id = ApexPages.currentPage().getParameters().get('AttachmentID');
                        att = [SELECT Body, ContentType, Name FROM Attachment WHERE ID = :id];
                  }
                  return att;
            }
            private set;
      }
      public String image {
            get {
                  return EncodingUtil.Base64Encode(att.body);
            }
      }
}

Can you implement using this sample code as an example? Let me know if this helps

Anudeep