You are viewing an archive of Victory Road.
Victory Road closed on January 8, 2018. Thank you for making us a part of your lives since 2006! Please read this thread for details if you missed it.
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.
#!/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);
?>