Does not show the image hosted in the SQL Server database

0

Here I again. It turns out that I'm looking to show an image hosted in the database. I tried decoding the base64 version and it showed me choppy, right now I was looking for how to do it by blob and it does not show me anything. Here I send the codes and how they are stored in the database (the server I occupy at work does not take the sqlsrv driver so I had to use one that is already obsolete).

blob.php:

<?php 
include 'src/functions/dbfunctions.php';
    $conn = connectDB();
    $id = $_GET['id'];

if ($id > 0){
    //vamos a crear nuestra consulta SQL
    $query = "SELECT imagen_GXI from formulario WHERE formularioId = '$id'"; 
    //con mysql_query la ejecutamos en nuestra base de datos indicada anteriormente
    //de lo contrario mostraremos el error que ocaciono la consulta y detendremos la ejecucion.
    $resultado= mssql_query($query, $conn) or die(mssql_error());

    //si el resultado fue exitoso
    //obtendremos el dato que ha devuelto la base de datos
    $datos = mssql_fetch_assoc($resultado);

    //ruta va a obtener un valor parecido a "imagenes/nombre_imagen.jpg" por ejemplo
    $imagen = $datos['imagen_GXI'];

    //ahora colocamos la cabeceras correcta segun el tipo de imagen
    header("Content-type: image/jpeg");

    echo $imagen;
}
?>

As I show the image in modvegetales.php

<img src="blob.php?id=<?php echo $id; ?>" />

This is how they are stored in the database:

And this is shown in blob.php according to the id:

Any help or suggestion I am grateful. Thanks!

    
asked by Roberto Caamaño Riquelme 07.06.2016 в 17:32
source

0 answers