Created
April 8, 2020 06:18
-
-
Save parzibyte/f6937660e616c598b7acb06dec0ca8b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once "bd.php"; | |
$id = $_GET["id"]; | |
if (empty($id)) { | |
exit("No existe el parámetro id en la URL"); | |
} | |
$sentencia = $base_de_datos->prepare("SELECT foto FROM fotos WHERE id = ?"); | |
$sentencia->execute([$id]); | |
$foto = $sentencia->fetchObject(); | |
if (!$foto) { | |
exit("No hay foto con ese ID"); | |
} | |
?> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Ver foto</title> | |
</head> | |
<body> | |
<h1>Foto:</h1> | |
<img src="data:image/png;base64,<?php echo $foto->foto; ?>"> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment