<?php
########## imagen_mostrar.php ##########
# debe recibir el id de la imagen a mostrar
# http://www.lawebdelprogramador.com
  
# Conectamos con MySQL
//$mysqli=new mysqli("localhost","root","","imagenes");
//if (mysqli_connect_errno()) {
//    die("Error al conectar: ".mysqli_connect_error());
//}


//$mysqli=new mysqli("localhost","us2025geproject","Geproject2025@","dbgeproject_images");

$mysqli=new mysqli("198.58.112.19","libreri1_usj2023","us20jhonat23an","libreri1_gp_images");

if (mysqli_connect_errno()) {
    die("Error al conectar: ".mysqli_connect_error());
}					 
 
# Buscamos la imagen a mostrar
$result=$mysqli->query("SELECT * FROM `imagephp_productos` WHERE prd_codi_fk = ".$_GET["xid"]);
$row=$result->fetch_array(MYSQLI_ASSOC);
 
# Mostramos la imagen
header("Content-type:".$row["tipo"]);
echo $row["imagen"];
//echo "<img src='".$row["imagen"]."' width='200px;' >";

?>

<script language="javascript">
alert("xid: <?php echo $_GET["xid"]; ?> ");
</script>