$image_size = getimagesize($filename); $pinfo = pathinfo($file["name"]); $ftype = $pinfo['extension']; $destination = $destination_folder . create_guid() . "." . $ftype; $content = "移动文件\n"; file_put_contents($file, $content, FILE_APPEND); if (!move_uploaded_file($filename, $destination)) { $content = "移动文件出错\n"; file_put_contents($file, $content, FILE_APPEND); echo "移动文件出错"; exit; } $path = "http://10.192.164.102/learn/"; $image = $path . $destination; $id = test_input($_POST["id"]); if ($updateimag->Update_image($id, $image) == "OK") { $updateback->kind = "OK"; $json = json_encode($updateback); echo "{$json}"; } } ?>
} catch (OssException $e) { 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 HeadImage(); $userid = test_input($_POST["userid"]); if ($insertimage->Update_image($userid, $kindbig) == "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数据添加失败"); } } } ?>