#!/usr/local/bin/perl # 2004/07/21 Kaburaya # files: painter_icon.cgi, cgi-lib.pl, painter_icon.css, painter_icon.jpg $script = './painter_icon.cgi'; require './cgi-lib.pl'; # ライブラリ使用 $css = './painter_icon.css'; # データ受け取りルーチン $len = $ENV{'CONTENT_LENGTH'}; if ( $len < 30 ) { &file_select; } if ( $len > 5000 ) { &head; print "Abort: File too large."; &tail; exit; } &ReadParse; $data = $in{'infile'}; # ファイル指定がないとき、ダイアログ提示 sub file_select { &head; print << "_HTML1_";
Painter 8.1 以降のカスタムパレットのアイコンデータを作成します。
30 x 30 ピクセルの RAW 形式画像ファイルを選択してください。

ファイルを選択したらこのボタンで GO! >>
_HTML1_ &tail; exit; } # ファイル指定があればテキストに変換して表示 &head; print << "_HTML2_";
_HTML2_ $pool = unpack('H*',$data); # convert to hex string $pool =~ s/(.{6})/$1 /g; # split at 6 chars $pool =~ s/(.{70})/$1\n/g; # 70 chars for each line $pool =~ s/ \n/
\n/g; # cut the tail space and add
$pool =~ s/ 0/ /g; # cut initial 0 $pool =~ s/^0//g; # cut initial 0, part 2 print $pool; print << "_HTML3_";

他のファイルも変換する >>
_HTML3_ &tail; exit; # ヘッダ部分 sub head { print "Content-type: text/html\n\n"; print << "_HEAD_"; RAW to Painter Icon Data
_HEAD_ } # フッタ部分 sub tail { print << "_TAIL_";
_TAIL_ }