Foros del Web » Programando para Internet » PHP »

ayuda para mostar imagen jpeg me devuelve la url y no la imagen

Estas en el tema de ayuda para mostar imagen jpeg me devuelve la url y no la imagen en el foro de PHP en Foros del Web. me devuelve este resultado i no la foto http://localhost/php/cacau30/foto.php?id_foto=0000 CREATE TABLE IF NOT EXISTS foto ( id_foto SMALLINT(4) UNSIGNED ZEROFILL NOT NULL, nombre_foto VARCHAR(50) UNIQUE ...
  #1 (permalink)  
Antiguo 24/12/2009, 05:31
 
Fecha de Ingreso: febrero-2009
Mensajes: 443
Antigüedad: 15 años, 2 meses
Puntos: 1
ayuda para mostar imagen jpeg me devuelve la url y no la imagen

me devuelve este resultado i no la foto
http://localhost/php/cacau30/foto.php?id_foto=0000


CREATE TABLE IF NOT EXISTS foto (
id_foto SMALLINT(4) UNSIGNED ZEROFILL NOT NULL,
nombre_foto VARCHAR(50) UNIQUE NOT NULL,
foto MEDIUMBLOB NOT NULL,
categoria_foto VARCHAR(50) NOT NULL,
format_foto VARCHAR(50) NOT NULL,
foto_id_producte SMALLINT (3) UNSIGNED ZEROFILL NOT NULL,
CONSTRAINT pk_id_foto PRIMARY KEY (id_foto),
)ENGINE=InnoDB;


insert
id_foto nombre_foto foto categoria_foto formato_foto foto_id_producte
0000 foto.jpeg [BLOB - 7.2 KB] reposteria image/jpeg 000











indice.html
<li><a href="foto.php?id_foto=0000">foto</a></li>

foto.php
<?
header("Content-Type: image/jpeg");
$link = mysqli_connect($hostname,$user,$password,$database );
$query = "select foto from foto where id_foto= $_GET[id_foto] ";
$result = mysqli_query($link, $query);

/* associative array */
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
echo "{$row['foto']}<br>\n";
}

/* free result set */
mysqli_free_result($result);

/* close connection */
mysqli_close($link);
?>
  #2 (permalink)  
Antiguo 24/12/2009, 05:53
Avatar de rompeguesos  
Fecha de Ingreso: marzo-2009
Mensajes: 692
Antigüedad: 15 años, 1 mes
Puntos: 8
Respuesta: ayuda para mostar imagen jpeg me devuelve la url y no la imagen

tienes que poner en el echo la etiqueta de imagen <img src=/"$row['foto']/" /> prueba y me dices
  #3 (permalink)  
Antiguo 24/12/2009, 06:06
 
Fecha de Ingreso: febrero-2009
Mensajes: 443
Antigüedad: 15 años, 2 meses
Puntos: 1
Respuesta: ayuda para mostar imagen jpeg me devuelve la url y no la imagen

no funciona

<?
header("Content-Type: image/jpeg");
$link = mysqli_connect($hostname,$user,$password,$database );
$query = "select foto from foto where id_foto= $_GET[id_foto] ";
$result = mysqli_query($link, $query);

/* associative array */
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
//echo "{$row['foto']}<br>\n";

echo "{<img src=/"$row['foto']/" />}<br>\n";

}

/* free result set */
mysqli_free_result($result);

/* close connection */
mysqli_close($link);
?>
  #4 (permalink)  
Antiguo 24/12/2009, 06:41
Avatar de rompeguesos  
Fecha de Ingreso: marzo-2009
Mensajes: 692
Antigüedad: 15 años, 1 mes
Puntos: 8
Respuesta: ayuda para mostar imagen jpeg me devuelve la url y no la imagen

ponlo asi:

Código PHP:
<?php
header
("Content-Type: image/jpeg");
$link mysqli_connect($hostname,$user,$password,$database );
$query "select foto from foto where id_foto= $_GET[id_foto] ";
$result mysqli_query($link$query);

/* associative array */
while ($row mysqli_fetch_array($resultMYSQLI_ASSOC)){
//echo "{$row['foto']}<br>\n";

echo "<img src=/"".$row['foto']."/" /><br>\n";

}

/* free result set */
mysqli_free_result($result);

/* close connection */
mysqli_close($link);
?>
  #5 (permalink)  
Antiguo 24/12/2009, 06:55
 
Fecha de Ingreso: febrero-2009
Mensajes: 443
Antigüedad: 15 años, 2 meses
Puntos: 1
Respuesta: ayuda para mostar imagen jpeg me devuelve la url y no la imagen

tampoco funciona
llevo un setmana con las fotos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:33.