Exemplo n.º 1
0
<?php

require_once 'include.php';
require_once 'Media/SWF/Converter.class.php';
require_once 'Media/SWF/SVGUtil.class.php';
require_once 'Media/SVG/Element.class.php';
require_once 'Media/SVG/Path.class.php';
require_once 'Media/SVG/Null.class.php';
require_once 'Media/SVG.class.php';
$dir = dirname(__FILE__) . '/swf';
$swfname = @$_GET['d'];
if ($swfname == null || !file_exists($dir . '/' . $swfname)) {
    throw new Exception('file not exists ' . $swfname);
}
$editor = new Media_SWF_Converter();
$editor->parse(file_get_contents($dir . '/' . $swfname));
$svg = $editor->toSVG();
$d = new DOMDocument();
$d->preserveWhiteSpace = false;
$d->formatOutput = true;
$d->loadXML($svg);
header("Content-type: image/svg+xml");
echo $d->saveXml();
Exemplo n.º 2
0
                exit(1);
            }
            if ($swfname === null) {
                $swfname = $argv[$i];
            } elseif ($output === null) {
                $output = $argv[$i];
            }
            break;
    }
}
if ($swfname === null) {
    echo "Use --swfname option\n";
    exit(1);
}
if ($output === null) {
    echo "Use --output option\n";
    exit(1);
}
if (!file_exists($swfname)) {
    echo "Input file is not found. \"" . $swfname . "\"\n";
    exit(1);
}
try {
    $editor = new Media_SWF_Converter();
    $editor->parse(file_get_contents($swfname));
    $editor->stage->saveWithCompress = $saveWithCompress;
    $editor->stage->useCompactSaveMode = $useCompactSaveMode;
    $editor->saveDeliveryContent($output);
} catch (Exception $e) {
    die($swfname . " is error '{$e->getMessage()}'");
}
Exemplo n.º 3
0
<?php

require_once 'include.php';
require_once 'Media/SWF/Converter.class.php';
require_once 'Media/SWF/SVGUtil.class.php';
require_once 'Media/SVG/Element.class.php';
require_once 'Media/SVG/Path.class.php';
require_once 'Media/SVG/Null.class.php';
require_once 'Media/SVG.class.php';
$dir = dirname(__FILE__) . '/swf';
$swfname = @$_GET['d'];
if ($swfname == null || !file_exists($dir . '/' . $swfname)) {
    throw new Exception('file not exists ' . $swfname);
}
$editor = new Media_SWF_Converter();
$editor->parse(file_get_contents($dir . '/' . $swfname));
//header("Content-type: text/json");
echo $editor->toJSON();
Exemplo n.º 4
0
require_once 'include.php';
require_once 'Media/SWF/Converter.class.php';
require_once 'Media/SWF/SVGUtil.class.php';
require_once 'Media/SVG/Element.class.php';
require_once 'Media/SVG/Path.class.php';
require_once 'Media/SVG/Null.class.php';
require_once 'Media/SVG.class.php';
$dir = dirname(__FILE__) . '/swf';
$swfname = @$_GET['d'];
$id = (int) @$_GET['id'];
if ($swfname == null || !file_exists($dir . '/' . $swfname)) {
    throw new Exception('file not exists ' . $swfname);
}
if (!$id) {
    throw new Exception('id require');
}
$editor = new Media_SWF_Converter();
$editor->parse(file_get_contents($dir . '/' . $swfname));
$tag = $editor->stage->getTagByCharacterId($id);
if ($tag instanceof Media_SWF_Tag_DefineBits) {
    header("Content-type: image/" . $tag->filetype);
    echo $tag->convertImageData();
} elseif ($tag instanceof Media_SWF_Tag_DefineBitsLossless) {
    header("Content-type: image/png");
    echo $tag->convertImageData();
} elseif ($tag instanceof Media_SWF_Tag_DefineShape) {
    header("Content-type: image/svg+xml");
    echo $tag->saveAsSVG();
} elseif ($tag instanceof Media_SWF_Tag_DefineSprite) {
}