#1
|
||||
|
||||
PHP Image List
Here is a script that I've used to put all banners to one big image.
This script put all(.png) images in a certain folder to one big image, this script uses greedy algorithm(http://en.wikipedia.org/wiki/Word_wrap#Algorithm ) of word wrapping. Code:
#!/usr/bin/php <?php //please edit. //width of the image. $Width = 2500; //height of the image $Height = 2500; //padding between all images. $padding = 15; $x = $padding; $y = $padding; $max = 0; $image = imagecreatetruecolor($Width, $Height); $col = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); imagefilledrectangle($image, 0, 0, imagesx($image), imagesy($image), $col); $files = explode("\n", `ls *.png`); foreach ($files as $file) { if (file_exists($file)) { $copy = imagecreatefrompng($file); if (!is_resource($copy)) { continue; } $sx = imagesx($copy); $sy = imagesy($copy); if ($x + $sx > imagesx($image)) { $y += $max; $x = $padding; } imagecopy($image, $copy, $x, $y, 0, 0, $sx, $sy); $x += $sx + $padding; if ($sy > $max) { $max = $sy + $padding; } imagedestroy($copy); } } imagepng($image); imagedestroy($image); ?> To use the script, edit the first few lines to change the options. Here is something I've generated with that script: http://spacemanplusplus.deviantart.com/ ... -113279109 |
|