Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/12/2008, 16:57
jorge7
 
Fecha de Ingreso: diciembre-2008
Mensajes: 1
Antigüedad: 15 años, 4 meses
Puntos: 0
problemas con imagenes en php

Bueno mi duda es como puedo mostrar una imagen con la url lo que pasa es que estoy guardando la url de las imagenes, pero a la hora de tratar de mostrarla solo me aparece la url y no la imagen
mi base de datos esta asi:

BD carritos

laptop1
**************
foto varchar(100),
clave int,
marca varchar(15),
windows varchar(15);

y el codigo que utilizo es el siguiente:

--------------------
lapto.html

<html>
<head><title>REGISTRAR NUEVA LAPTOP</title></head>
<body bgcolor = "sky blue">
<font color = "blue" size = "+3">
<center>



<form method = "post" name = "procedim" action = "InsertIntoLaptop.php" enctype="multipart/form-data">
IMAGEN: <input type = "file" name= "foto"><br>
CLAVE: <input type = "text" name = "clave"><br>
MARCA: <input type = "text" name = "marca"><br>
WINDOWS: <input type = "text" name = "windows"><br>
<input type = "submit" name = "boton" value = "Registrar Laptop"><br>
</form>
</center>
</font>
</body>
</html>

------------------------
InsertIntoLaptop.php

<?php
$db=mysql_connect("localhost","root","toor",$db);
mysql_select_db("carritos",$db);

$foto = $_FILES['foto']['name'];
$clave=$_POST[clave];
$marca=$_POST[marca];
$windows=$_POST[windows];
echo"$imagen";


// "imagenes" es el directorio donde voy a subir la imagen.
mysql_query("insert into laptop1 (foto , clave , marca , windows) values('/imagenes/$foto','$clave','$marca','$windows')",$db) or die("La clave introducida, ya existe. Elige otra");

//ahora subo la imagen, "imagenes" es el directorio donde la voy a subir.
$copy = copy($_FILES['foto']['tmp_name'], "../uppics/imagenes/" . $_FILES['foto']['name']);

header("Location:ver.php");
?>


----------------------------------

ver.php

<body>
<html>
<head><title>MOSTRAR</title></head>
<center>

<form method = "post" name = "procedim" action = "fotos.php" >

CLAVE: <input type = "text" name = "clave"><br>

<input type = "submit" name = "boton" value = "mostrar"><br>
</form>
</center>
</font>

</body>
</html>

--------------------------------
fotos.php

// AQUI CREO ESTA EL PROBLEMA PERO NO SE CUAL ES //

<?php

$clave = $_POST['clave'];

@mysql_connect("localhost","root","toor");
@mysql_select_db("carritos");

$query = "SELECT foto FROM laptop1 WHERE clave = '$clave'";
$result = @mysql_query($query);
$imagen = @mysql_result($result,0);

header( "Content-type: image/jpeg");
echo "'$imagen'" ;
?>

si alguien pudiera decirme porfavor donde esta el error se los agradeceria mucho
GRACIAS!!