D . Walsh wrote:
Here's a working solution, build with the command gcc create_php_logo.c -o create-php-logo

The same could be done more easily in PHP in a couple of lines, e.g.

#!/usr/bin/php
<?php

echo "#define CONTEXT_TYPE_IMAGE_GIF \"Content-Type: image/gif\"\n\nunsigned char " . basename($argv[1], ".gif") . "_logo[] = {";

$data = file_get_contents($argv[1]);

for ($i = 0; $i < strlen($data) - 1; $i++)
{
        if ($i % 10 == 0)
                echo "\n\t";

        printf("%4d,", ord($data{$i}));
}


printf("%4d };\n", ord($data{$i}));

?>

Note: No effort was put into minimizing the program length :-)

- Chris

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to