Jump to content

PNG Graphics Help Please


niwa3836

Recommended Posts

Hi all,

Have tried to find a solution to this but dont seem to be able too. I am "sure" something must exist to do it, but wood for the trees and all that.

 

Basically I am happy creating good old 100x100 PNG files. What I would like to be able to do is either from file, or in memory join a number of these to make 1 PNG file 500x500 (i.e. 5 x 5 PNG pictures in a single PNG).

 

Anyone know how? Thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/134421-png-graphics-help-please/
Share on other sites

here is a exmaple

<?php

$output = imagecreatetruecolor(500,500);

for($x = 0; $x < 500 $x+=100){

    for($y = 0; $y < 500 $y+=100){

        $import = imagecreatefrompng("images/" . ($x/100) . "." . ($y/100) . ".png");

        imagecopyresampled($output,$import,$x,$y,0,0,100,100,100,100);

    }

}

header('Content-Type: image/png');

imagepng($output);

?>

the images folder has images named 1.0.png then 1.1.png the follow the form (x cord).(y cord).png

 

Scott.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.