I want to make a banner with the images saved in database, but banner get a strange color when $imagesB take images from database , when i put the link of one photo in $imagesB, this keep the real color and i don't know why image take a greener color when i take from database.
this is the code
<?php
require('db.php');
session_start();
$w = 480*10;
$h = 270*5;
header("Content-Type: image/png");
$im = imagecreate($w, $h) or die("Cannot initialize GD extension");
$canvas = imagecolorallocate($im, 245, 245, 245);
$sql = "SELECT * FROM Cinema";
$result = mysqli_query($mysqli, $sql);
$results = array();
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$results[] = $row['Coperta'];
}
}
for($i=0;$i<10;$i++){
// here i also tried to obtain the photos directly from mysql with $imagesB ="http://projects.rusticwoodromania.com/uploads/".$row['Coperta']; but the same results
$imagesB = "http://projects.rusticwoodromania.com/uploads/".$results[$i];
// when this link it's "http://projects.rusticwoodromania.com/uploads/1535026678_545047747.png"; the image look normal not with this kind of green
$imgB = imagecreatefrompng($imagesB);
$a = $i*480;
for($j=0;$j<5;$j++){
$b = $j*270;
imagecopyresampled($im, $imgB, $a, $b, 0, 0, 480, 270, 480, 270);
}
}
imagepng($im);
?>