Field byte type in postgresql show it in a Laravel view

0

Good afternoon I have been working with Laravel 5.6 and I must pass an image that is inserted in a postgresql 10 database as a byte field type made embedded php code in view to be able to pull the data and present it but I did not succeed this is the code of sight:

@extends('template.main')
@section('contenido')
<div class="contenido">
  <div class="contenedor-titulo">
    <h4 class="text-center">Reporte</h4>
    <h3 class="text-center">{{ "Nro Archivo"." ".$id_archivo}}</h4>
  </div>  
<div class="row">

   <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
        <table class="table   table-bordered" style="font-size: 10px;">
          <tr>
            <td colspan="4">


            <?php
               $conexion= pg_connect("user=xxxxxx password=xxxxxxx dbname=xxxxx host=xxxxxx port=5723");    
              $idarchivo=$Datoarchivo->id;     
              $query = pg_query($conexion, "SELECT nombre FROM t_fotografia WHERE id_archivo = $idarchivo");
              $raw = pg_fetch_result($query, 'nombre');
              header('Content-type: image/jpg');
              $foto=pg_unescape_bytea($raw);
              echo "<img src='Content-type: image/jpg; base64,'".base64_encode($foto)."height='20%' class='img-responsive'>";


              ?>             
            </td>
          </tr> 
          <tr>
              <td class="table-active td-titulo">Nombre</td>
              <td class="td-contenido">{{ $Datoarchivo->nombre }}</td>
              <td class="table-active td-titulo">Apellido</td>
              <td class="td-contenido">{{ $Datoarchivo->apellido }}</td>
          </tr>
          <tr>
              <td class="table-active td-titulo">Documento</td>
              <td class="td-contenido">{{ $Datoarchivo->nro_documento }}</td>
              <td class="table-active td-titulo">Provincia:</td>
              <td class="td-contenido">{{ $Datoarchivo->provincia }}</td>
          </tr>

       </table>  
   </div>

@endsection

Could someone guide me as I should or how am I failing ???

    
asked by ALVARO ROBERTO BACARREZA ARZAB 26.10.2018 в 16:25
source

0 answers