How to display an image with PHP session

Asked

Viewed 43 times

-4

What I can do to display an image (only the address is saved) that is saved in the database using the sessions?

1 answer

1

Vinicius, as you’ve given no detail of what you have of code, I’m giving you a very generic example of how it could be done, but, this is far from ideal to be done, it’s just a notion of how it could be.

<?php
$endImagem = funcaoSelectImagem(); // Retorna o campo com o endereço completo da imagem.
if ($endImagem != NULL) {
   ?>
   <img src="<?php print($endImagem) ?>" width="200" height="200">
   <?php
} else {
   print("Imagem não existe.");
}
?>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.