method
インストール
composer require yoya/io_swf
使い方サンプル
中身を見る
php vendor/yoya/io_swf/sample/swfdump.php -f test.swf
- pear 環境によって /usr/share/php 以外の可能性もあるので適宜変えて下さい。
- SWF バイナリをデバッグしたい場合は、-h を付けると 16進も一緒に表示するので便利です。
画像入れ替え
$swf_data = file_get_contents('test.swf');
$bitmap_id = 1; // swfdump で調べてね!
$bitmap_data = file_get_contents('aria.png');
$swf = new IO_SWF_Editor();
$swf->input($swf_data);
$swf->replaceBitmapData($bitmap_id, $bitmap_data)
サイズや色指定でも入れ替え出来ます。
$swf_data = file_get_contents('test.swf');
// 100x100の赤い画像と入れ替える
$bitmap_conf = array('width' => 100, 'height'=>100,
'red'=>255, 'green'=>0, 'blue'=>0);
$bitmap_data = file_get_contents('aria.png');
$swf = new IO_SWF_Editor();
$swf->input($swf_data);
$swf->replaceBitmapData($bitmap_cond, $bitmap_data)
IO_SWF_Editor method
- input($data)
- build()
- dump()
- setCharacterId()
- replaceActionStrings($params)
- setActionVariables($vars)
- replaceActionStrings($trans_table)
- replaceBitmapData($bitmap_id, $bitmap_data, $jpeg_alphadata = null)
- deformeShape($threshold);
- countShapeEdges() => array(shape_id1 => count1, shape_id2=count2, ...)
- replaceMovieClip($target_path, $movieclip_swfdata);
- replaceEditText($id, $initialText);
関連