I have the code below, where it connects to the database, takes the name of the image and saves it in an Array:
while($row = $stm->fetch()) {
echo "<img src=thumb.php?img=".$row['foto']."/>";
}
The file thumb.php, which does all the processing of the image to leave in gallery:
$filename = $_GET['img'];
$percent = 0.10;
// Cabeçalho que ira definir a saida da pagina
header('Content-type: image/jpeg');
// pegando as dimensoes reais da imagem, largura e altura
list($width, $height) = getimagesize($filename);
//setando a largura da miniatura
$new_width = 120;
//setando a altura da miniatura
$new_height = 100;
//gerando a a miniatura da imagem
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
//o 3º argumento é a qualidade da imagem de 0 a 100
imagejpeg($image_p, null, 50);
imagedestroy($image_p);
The images are in the same directory where the index.php that connects in the bank and shows the gallery and the file thumb.php.
The problem that does not display the photo and does not generate any error. Behind the photo comments that are in the bank, but not the image.