Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Can';t通过POST将swf中的原始数据转换为图像_Php_Flash - Fatal编程技术网

Php Can';t通过POST将swf中的原始数据转换为图像

Php Can';t通过POST将swf中的原始数据转换为图像,php,flash,Php,Flash,我这里有一个swf文件,它将通过POST发送一个base64编码到PHP。现在我通过$dataCode=file\u get\u contents(“php://input"); 我想要实现的是通过PHP将swf编码的base64转换为image,并将其保存到特定的文件夹中 这是我的代码,但目前我只是将其剥离,以查看imagecreatefromstring是否返回真值并在页面上输出图像: $dataCode = file_get_contents("php://input");

我这里有一个swf文件,它将通过POST发送一个base64编码到PHP。现在我通过$dataCode=file\u get\u contents(“php://input");

我想要实现的是通过PHP将swf编码的base64转换为image,并将其保存到特定的文件夹中

这是我的代码,但目前我只是将其剥离,以查看imagecreatefromstring是否返回真值并在页面上输出图像:

    $dataCode = file_get_contents("php://input");
    $dataCode = explode("=", $dataCode);
    $data = $dataCode[1];

    $imageData = rawurldecode($data);
    $source = imagecreatefromstring($imageData);

    if ($source !== false) {
        header('Content-Type: image/png');
        imagepng($source);
        imagedestroy($source);
    }
    else {
        echo 'An error occurred.';
    }
然后在这之后,我将把它保存到文件夹中,并通过XML输出图像的url

大概是这样的:

header("Content-Type:application/rss+xml");        
echo '<?xml version=\"1.0\"?>
<data>
  <result status="1">
    <url>'.$basepath.'converted.jpg'.'</url>
  </result>
</data>';
标题(“内容类型:应用程序/rss+xml”);
回声'
“.$basepath.”已转换为.jpg“。”
';
错误是imagecreatefromstring返回的值为false,如果遇到此问题,请提供帮助。我不知道图像是否损坏,或者我在这里做错了什么。任何建议或帮助都很好。谢谢


在您的列表中,您已经使用rawurldecode()进行了解码。尝试使用base64_decode()

您可以包含闪存代码吗??