Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/09/2008, 07:35
Avatar de hoberwilly
hoberwilly
 
Fecha de Ingreso: julio-2008
Ubicación: Lima - Perú
Mensajes: 769
Antigüedad: 15 años, 10 meses
Puntos: 2
Pregunta Mostrar imagen, que esta guardado en servidor

Les pido su ayuda por favor, navegando x la web encontre este script ...lo que hace es subir las imagenes en una carpeta fotografias en el servidor y en la bd guarda la ruta(oka):
subirImagen.php
----------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>

</head>
<body>
<?php
if($enviar)
{
include('conec.php');
conectarse();
if (is_uploaded_file($_FILES['nomimg']['tmp_name'])) {
if ($_FILES['nomimg']['type'] == "image/jpeg" || $_FILES['nomimg']['type'] == "image/pjpeg" || $_FILES['nomimg']['type'] == "image/JPG")
{
$nuevoNombre = time().".jpg";
move_uploaded_file($_FILES['nomimg']['tmp_name'], "fotografias/$nuevoNombre");
$ruta = "fotografias/$nuevoNombre";
chmod($ruta, 0777);
$contenido = stripslashes($_POST['contenido']);
$contenido = strip_tags($contenido);
$titulo = $_POST["titulo"];
$mensaje = $_POST["mensaje"];
mysql_query("INSERT INTO noticias (nomimg,contenido,titulo) VALUES('".$ruta."','".$_POST[contenido]."','$titulo')") or die('MySQL error: '.mysql_error());
echo "imagen $nuevoNombre subida con éxito";
}
else{
echo "Formato no válido para fichero de imagen";
}
}else{
echo "Error al cargar imagen: ".$_FILES['nomimg']['name'];
}
}
else{
?>
<form enctype="multipart/form-data" action="<?=$_SERVER['PHP_SELF']?>" method="post">
<input name="nomimg" type="file" /><br />
Comentario:<br />
<textarea name="contenido" cols="50" rows="5"></textarea><br />
<input type="text" size="50" maxlength="45" id="titulo" name="titulo"><br />
<input type="submit" name="enviar" value="Subir Fichero" />
</form>
<?php
}
?>
</body>
</html>

y este es el codigo el cual muestra la noticia con su respectiva imagen, el problema esta en que muestra el titulo de la noticia pero no logro mostrar la imagen con <img>?????? ...solo me sale una aspa
noticia.php
---------------
<?
if(!isset($_GET['idNoticia']) || empty($_GET['idNoticia'])){
header("location:listaNoticia.php");
}
else{
include('conec.php');
conectarse();
$query = mysql_query("SELECT * FROM noticias WHERE idNoticia = '".$_GET['idNoticia']."'") or die('MySQL error: '.mysql_error());

while($row = mysql_fetch_array($query)){
echo "<h3>".$row['titulo']."</h3>".$row['mensaje'];
}
}
?>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top"><img src="<?=$row['nomimg']?>"></td>
</tr>
</table>

Gracias de antemano su apoyo