These pages are written by only Japanese.
|
Namazu for hns による簡易全文検索です。 詳細は 詳細指定/ヘルプをご参照下さい。 |
|||||||||||||||||||||||||||||||||||||||||||||||
$im = imagecreatefromgif($giffile); if ($im === false) { echo "$giffile is not GIF file\n"; exit (1); } $colormap_num = imagecolorstotal($im); $transparent_index = imagecolortransparent($im); $colormap = ''; if ($transparent_index < 0) { for ($i = 0 ; $i < $colormap_num ; $i++) { $rgb = imagecolorsforindex($im, $i); $colormap .= chr($rgb['red']); $colormap .= chr($rgb['green']); $colormap .= chr($rgb['blue']); } } else { for ($i = 0 ; $i < $colormap_num ; $i++) { $rgb = imagecolorsforindex($im, $i); $colormap .= chr($rgb['red']); $colormap .= chr($rgb['green']); $colormap .= chr($rgb['blue']); $colormap .= ($i == $transparent_index)?chr(0):chr(255); } } $indices = ''; $i = 0; $width = imagesx($im); $height = imagesy($im); for ($y = 0 ; $y < $height ; $y++) { for ($x = 0 ; $x < $width ; $x++) { $indices .= chr(imagecolorat($im, $x, $y)); $i++; } while (($i % 4) != 0) { $indices .= chr(0); $i++; } } $format = chr(3); // palett format $content = pack('v', $image_id).$format.pack('v', $width).pack('v', $height); $content .= chr($colormap_num - 1).gzcompress($colormap.$indices); if ($transparent_index < 0) { $tagCode = 20; // DefineBitsLossless } else { $tagCode = 36; // DefineBitsLossless2 }これで、$content に Lossless 形式のデータ(image_id混み))が入ります。
WindowsにViretualBoxを入れ、そこから仮想マシン(Ubuntu)を立ち上げそこから全部操作していました。 ですので同じX Server上で動作していると思うのですが…。Skype を起動したのと同じ terminal で PHP を起動してエラーになるのであれば、僕の予想は外れです。