sae 圖種產生

來源:互聯網
上載者:User
放在sae上,線上產生圖種。
http://tuzhong.sinaapp.com
  1. require('db.php');
  2. if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  3. $stor = new SaeStorage();
  4. //確保有足夠的空間
  5. $stor_size=$stor->getDomainCapacity($domain);//擷取已用大小
  6. if($stor_size>=2*1000*1024*1024)
  7. {
  8. //刪除2個檔案
  9. }
  10. $bitfile = $_FILES[upfile];
  11. $picfile = $_FILES[uppic] ;
  12. if($bitfile['size'] >=1024 * 1024 * 10){
  13. echo '';
  14. return ;
  15. }
  16. if(empty($picfile)){//上傳了圖片的話
  17. //檔案類型為圖片,pjpeg為ie中的jpg類型,並且檔案大小不得大於10m
  18. if (in_array($picfile['type'], array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/png'))
  19. && $picfile['size'] <=1024 * 1024 * 10) {
  20. $fp = fopen($picfile['tmp_name'], "rb");
  21. $picdata = fread($fp, filesize($picfile['tmp_name']));
  22. }else{
  23. echo '';
  24. return ;
  25. }
  26. }else{
  27. //如果沒上傳檔案就使用這一個圖片
  28. $picdata = $stor->read($domain,$BasePicture);
  29. }
  30. $fp = fopen($bitfile['tmp_name'],'rb');
  31. $bitdata = fread($fp,filesize($bitfile['tmp_name']));
  32. //合并的臨時檔案
  33. $fileName = md5(time()).".png";
  34. $filePath = SAE_TMP_PATH.$fileName;
  35. $fp = fopen($filePath,'w');
  36. fwrite($fp,$picdata);
  37. fwrite($fp,$bitdata);
  38. fclose($fp);
  39. //上傳檔案
  40. $url = $stor->upload($domain,$fileName,$filePath);
  41. echo "";
  42. }
  43. ?>
複製代碼
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.