示例#1
0
header("Access-Control: allow <*>");
//Support Cross Domain
$xmlstr = stripslashes($_REQUEST['svg']);
$xml = new SimpleXMLElement($xmlstr);
//Flash:
require_once "freemoviecompilertoolbox.php";
$height = $_REQUEST['height'];
$width = $_REQUEST['width'];
$framerate = $_REQUEST['framerate'];
$swf = new FreeMovieCompilerToolbox();
$swf->SetSWFVersion(5);
$swf->SetFrameSize($width * 20, $height * 20);
$swf->SetFrameRate($framerate);
$swf->SetBackgroundColor(255, 255, 255);
$swf->BeginMovie();
function rgbConvert($rgb_str)
{
    $rgb = $rgb_str;
    $rgb = str_replace("rgb(", "", $rgb);
    $rgb = str_replace(")", "", $rgb);
    $rgbArray = explode(",", $rgb);
    return $rgbArray;
}
$totalSWFObjects = 0;
foreach ($xml->svg as $svg) {
    if ($svg['t'] != 'f') {
        if ($charid != null || $chardepth != null) {
            for ($p = 0; $p <= $totalSWFObjects - 1; $p++) {
                $swf->RemoveObjectFromLayer($charid[$p], $chardepth[$p]);
            }