return $data;
}
function create_guid()
{
    $charid = strtoupper(md5(uniqid(mt_rand(), true)));
    $hyphen = chr(45);
    // "-"
    $uuid = substr($charid, 0, 8) . $hyphen . substr($charid, 16, 4) . $hyphen . substr($charid, 20, 12);
    return $uuid;
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $content = "\n传过来的ID值:";
    file_put_contents($file, $content, FILE_APPEND);
    $content = test_input($_POST["id"]);
    file_put_contents($file, $content, FILE_APPEND);
    $updateimag = new CommentImage();
    $updateback = new Backinform();
    $file = $_FILES["upfile"];
    if (!is_uploaded_file($_FILES["upfile"]["tmp_name"])) {
        $content = "图片不存在";
        file_put_contents($file, $content, FILE_APPEND);
        $updateback->kind = "no";
        exit;
    }
    if ($max_file_size < $file["size"]) {
        $content = "文件太大";
        file_put_contents($file, $content, FILE_APPEND);
        $updateback->kind = "big";
        echo "文件太大!";
        exit;
    }
     WriteLog("上传原图失败信息" . $e->getMessage());
     $backinfo->kindbig = "NO";
 }
 Outputsmallimage($filename, 100, $destination_folder, $imagesmall);
 $object2 = "Ionic/Imagesmall/" . $imagesmall;
 $path = $destination_folder . $imagesmall;
 try {
     $ossClient->uploadFile($bucket, $object2, $path);
     $backinfo->kindsmall = "OK";
 } catch (OssException $e) {
     WriteLog("上传压缩图失败信息" . $e->getMessage());
     $backinfo->kindsmall = "NO";
 }
 unlink($path);
 if ($backinfo->kindsmall == "OK" && $backinfo->kindbig == "OK") {
     $insertimage = new CommentImage();
     $resourceid = create_guid();
     $mediaid = "DB5483ADCADC3ADC1E5CD2";
     $linkid = test_input($_POST["id"]);
     $linktype = test_input($_POST["eventtype"]);
     WriteLog("连接ID:" . $linkid . "--连接类型:" . $linktype . "\n");
     $resourcetype = "图片";
     if ($insertimage->Insert_image($resourceid, $mediaid, $linktype, $linkid, $resourcetype, $object2, $object) == "OK") {
         $backinfo->kind = "OK";
         $json = json_encode($backinfo);
         echo "{$json}";
         WriteLog("资源ID:" . $resourceid . "--成功上传截止:" . date('y-m-d h:i:s', time()) . "\n");
     } else {
         WriteLog("\n数据添加失败");
     }
 }