Show Blob in an image in Visualforce

0

I have a text field enriched in an object in salesforce in which I have to save an image that the user will insert this image from an inputFILE.
This I already manage to make the image to base64 and I keep it in the object but now I occupy to show that image. I un-convert the image but it shows nothing. I leave the code

  -- VisualforcePage

  <apex:commandLink styleclass="slds-button slds-button--brand" value="Ver" action="{!MostrarImagen}" >  
    <apex:param value="{!item.Codigo_Referencia__c}" AssignTo="{!Num_CodReferencia}"  name="APV1APROBACION" /> 
  </apex:commandLink>

Neither of these two forms shows the image

  <apex:image id="theImage" src="{!DesconvertirImagen}" width="200" height="200"/>
  <img src="data:base64,{!DesconvertirImagen}"  /> 



//Lo que me retorna el proceso de desconversion es esta cadena de datos. 
core.filemanager.ByteBlobValue@16b9bb42


-- ControllerClasesConciliacion 

public Blob DesconvertirImagen {get;set;}   

public void MostrarImagen()
{    

  try
  {    
    for(integer i=0; i < McontenidoAporte.size(); i++)
    {

      if(McontenidoAporte[i].Codigo_Referencia__c == Num_CodReferencia)   
      {

        DesconvertirImagen = EncodingUtil.base64Decode( McontenidoAporte[i].Comprobante_imagen__c);


      } //fin del if 

    } //fin for      
  }
  catch(exception e)
  {
    system.debug('Error: ' + e.getMessage() + ' Linea: ' + e.getLineNumber());
    ApexPages.addMessage(new ApexPages.Message( ApexPages.Severity.Error, 'Ha ocurrido un error!'+ e.getMessage() + ' Linea: ' + e.getLineNumber()));
  }      

} 
    
asked by acerrato 06.05.2018 в 19:25
source

0 answers