• php 上传二进制流图片 转存到图片格式 本地


     1     // 图片上传 binary 二进制
     2     public function videoAlertUpload()
     3     {
     4 // app.php
     5 //        'FILE_BIG' => 'http://0.0.0.0:8073/', // 大容量文件服务器(视频)
     6 //        'FILE_DIR' => '/mnt/dataHdd/fileServer', // 大容量文件服务器(视频)
     7 //        $rootPath =  Env::get('root_path').'public/upload/videoAlert/';
     8         $rootPath = config('FILE_DIR').'videoAlert/'; // 服务器磁盘路径
     9         $webPath = config('FILE_BIG').'videoAlert/';  // 服务器对外配置路径
    10         $rootPath = $rootPath.date("YmdHis",time()).'.jpg';
    11         $webPath = $webPath.date("YmdHis",time()).'.jpg';
    12 
    13         $input_handler = fopen('php://input', 'r');
    14         $temp = tmpfile();
    15         $realSize = stream_copy_to_stream($input_handler, $temp);
    16         fclose($input_handler);
    17         $out_handler = fopen($rootPath, 'w');
    18         fseek($temp, 0, SEEK_SET);
    19         stream_copy_to_stream($temp, $out_handler);
    20         fclose($out_handler);
    21         // Log::write($rootPath,'log');
    22         Res::suc('ok',$webPath);
    23     }
  • 相关阅读:
    I Hate It HDU
    线段树为什么要开4倍空间
    敌兵布阵 HDU
    线段树 模板
    线段树原理详解
    HDU5037 Frog
    HDU5187 zhx's contest
    HDU5307 He is Flying
    UOJ#34. 多项式乘法
    Bzoj4766 文艺计算姬
  • 原文地址:https://www.cnblogs.com/xujian2016/p/14745494.html
Copyright © 2020-2023  润新知