svnno****@sourc*****
svnno****@sourc*****
2011年 2月 23日 (水) 22:41:39 JST
Revision: 366 http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=366 Author: yoya Date: 2011-02-23 22:41:39 +0900 (Wed, 23 Feb 2011) Log Message: ----------- 画像一覧に Shape の画像も表示する Modified Paths: -------------- trunk/www/swfimagelist.php Added Paths: ----------- trunk/www/shapetpl.swf trunk/www/swfshape.php -------------- next part -------------- Added: trunk/www/shapetpl.swf =================================================================== (Binary files differ) Property changes on: trunk/www/shapetpl.swf ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Modified: trunk/www/swfimagelist.php =================================================================== --- trunk/www/swfimagelist.php 2011-02-17 22:42:14 UTC (rev 365) +++ trunk/www/swfimagelist.php 2011-02-23 13:41:39 UTC (rev 366) @@ -11,8 +11,18 @@ $swf->input($swfdata); echo "<table border=1>\n"; -echo "<th> tag </th> <th> image_id </th> <th> image </th>\n"; -foreach ($swf->getTagList() as $tag_seqno => $tagblock) { +echo "<th> tag </th> <th> cid </th> <th> image </th>\n"; +$tag_list = $swf->getTagList(); + +foreach ($tag_list as $tag_seqno => &$tagblock) { + $tagblock['detail_info'] = $swf->getTagDetail($tag_seqno); +} + +// getTagDetail 後に getShape が動かないバグの対処で仕方なく +$swf = new SWFEditor(); +$swf->input($swfdata); + +foreach ($tag_list as $tag_seqno => $tagblock) { $tag= $tagblock['tag']; $ext = ''; if (($tag == 6) || ($tag == 21) || ($tag == 35)) { @@ -21,26 +31,49 @@ if (($tag == 20) || ($tag == 36)) { $ext = '.png'; } + if (($tag == 2) || ($tag == 22) || ($tag == 32)) { + $ext = '.shape'; + } if (empty($ext)) { continue; } + $name = $tagblock['tagName']; $detail = $tagblock['detail']; - $detail_info = $swf->getTagDetail($tag_seqno); - $image_id = $detail_info['image_id']; - $image_filename = "$tmp_prefix$id-$image_id$ext"; - if ($ext == '.jpg') { - $image_data = $swf->getJpegData(intval($image_id)); + $detail_info = $tagblock['detail_info']; + if (isset($detail_info['image_id'])) { + $cid = $detail_info['image_id']; } else { - $image_data = $swf->getPNGData(intval($image_id)); + $cid = $detail_info['shape_id']; } + $image_filename = "$tmp_prefix$id-$cid$ext"; + + + if ($ext == '.jpg') { + $image_data = $swf->getJpegData(intval($cid)); + } elseif($ext == '.png') { + $image_data = $swf->getPNGData(intval($cid)); + } else { // shape + $image_data = $swf->getShapeData(intval($cid)); + } if (! is_readable($image_filename)) { file_put_contents($image_filename, $image_data); } echo "<tr>\n"; echo "<td> $name($tag) </td> "; - echo "<td> $image_id (ext=$ext)</td>\n"; - echo "<td> <img src=\"./swfimage.php?id=$id&image_id=$image_id&ext=$ext\"> </td>"; + echo "<td> $cid (ext=$ext)</td>\n"; + + if (($ext == '.jpg') || ($ext == '.png')) { + echo "<td> <img src=\"./swfimage.php?id=$id&image_id=$cid&ext=$ext\"> </td>"; + } else { // shape + echo "<td> +<object width='240' height='240'> +<param name='movie' value='./swfshape.php?id=$id&shape_id=$cid&ext=$ext'> +<embed src='./swfshape.php?id=$id&shape_id=$cid&ext=$ext' width='240' height='240'> +</embed> +</object> +</td>"; + } echo "</tr>\n"; } echo "</table>\n"; Added: trunk/www/swfshape.php =================================================================== --- trunk/www/swfshape.php (rev 0) +++ trunk/www/swfshape.php 2011-02-23 13:41:39 UTC (rev 366) @@ -0,0 +1,21 @@ +<?php + +require_once('define.php'); + +$id = $_REQUEST['id']; +$shape_id = $_REQUEST['shape_id']; +$ext = $_REQUEST['ext']; + + + +$shape_filename = "$tmp_prefix$id-$shape_id$ext"; +$shape_data = file_get_contents($shape_filename); + +$swf_data = file_get_contents("shapetpl.swf"); + +$swf = new SWFEditor(); +$swf->input($swf_data); +$swf->replaceShapeData(1, $shape_data); + +header("Content-type: application/x-shockwave-flash"); +echo $swf->output();