Heim  >  Artikel  >  php教程  >  php 保存flash发送数据成图片

php 保存flash发送数据成图片

WBOY
WBOYOriginal
2016-06-08 17:29:46917Durchsuche

我们在作flash 在线拍照片时要保存由flash HTTP_RAW_POST_DATA过来的数据,我们就可把flash发送过来的图片数据保存起来,下面就来看看源码吧。

<script>ec(2);</script>

@session_start();
require_once("../Inc/Conn.php");
require_once("../Inc/function.php");

$filepath = '../userhead/';
$filename = time().mt_rand(10,100);
//$uid = get_id($_SESSION['uname']);
$uid = 14;


if (isset($GLOBALS["HTTP_RAW_POST_DATA"]))
{
   $im = $GLOBALS["HTTP_RAW_POST_DATA"];
   if( !is_dir( $filepath ) )
   {
       mkdir($filepath,0777);
   }
 
   if(file_put_contents($filepath.$filename.'.jpg',$im))
   {
    $path = 'http://'.$_SERVER['HTTP_HOST'].'/userhead/'.$filename.'.jpg';
   savaPath($path);
    }
   else
   {
    ShowMsg('result:false');
    }
}

function savaPath($path)
{
 global $uid; 
 $sql = "Insert into dd(oy_uid,oy_dsp,oy_path) value('$uid','','$path')";
 if( mysql_query( $sql ) )
 {
  ShowMsg('result:true');
 }
 else
 {
  ShowMsg('result:false'.mysql_error());
 }
}

?>

本站原创转载注明:www.111cn.net/phper/php.html

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn