I’m trying to run a simple script to compile a composite png from a group of individuals.
Viewing each tile individually ( here ) correctly shows the tiles individually colored/discolored depending on state in the database.
However, when compiling them together, I come up with this. An orange-ish wash over the whole image.
$res exists and has the correct information.
$col = 0;
$srow = 0;
$out = imagecreate(512,(64*ceil($res->num_rows/8)));
while($row = $res->fetch_array()) {
if(!file_exists('gametiles/'.$row['id'].'.jpg')) {
copy("http://tiles.xbox.com/tiles/".$row['tile'].".jpg",'gametiles/'.$row['id'].'.jpg');
}
$source = imagecreatefromjpeg('gametiles/'.$row['id'].'.jpg');
imagecopymergegray($source,$source,0,0,0,0,64,64,(100*$row['achieved']));
imagecopy($out,$source,(64*$col),(64*$srow),0,0,64,64);
$col++;
if ($col == 8) {
$col = 0;
$srow++;
}
}
imagepng($out);
What am i missing?