李帅

1.微调一下接口,打印参数

...@@ -30,7 +30,7 @@ class ImmerseController extends AdminController ...@@ -30,7 +30,7 @@ class ImmerseController extends AdminController
30 return Grid::make(new Immerse(), function (Grid $grid) { 30 return Grid::make(new Immerse(), function (Grid $grid) {
31 // 去掉新增和删除按钮 31 // 去掉新增和删除按钮
32 $grid->disableCreateButton(); 32 $grid->disableCreateButton();
33 - $grid->disableFilterButton(); 33 +// $grid->disableFilterButton();
34 34
35 $grid->model()->where('user_id','=',1); 35 $grid->model()->where('user_id','=',1);
36 36
...@@ -55,12 +55,11 @@ class ImmerseController extends AdminController ...@@ -55,12 +55,11 @@ class ImmerseController extends AdminController
55 $grid->column('temp_id'); 55 $grid->column('temp_id');
56 $grid->column('thumbnail')->image(); 56 $grid->column('thumbnail')->image();
57 $grid->column('bgm')->display(function ($url){ 57 $grid->column('bgm')->display(function ($url){
58 + if ($url == '') return "无";
58 if (Str::of($url)->contains('.mp3')) 59 if (Str::of($url)->contains('.mp3'))
59 return "<a target='_blank' href='". $url ."'>查看</a>"; 60 return "<a target='_blank' href='". $url ."'>查看</a>";
60 - elseif (Str::of($url)->contains('.aac'))
61 - return "<a target='_blank' href='". $url ."'>下载</a>";
62 else 61 else
63 - return "无效路径"; 62 + return "<a target='_blank' href='". $url ."'>下载</a>";
64 }); 63 });
65 $grid->column('created_at'); 64 $grid->column('created_at');
66 $grid->column('updated_at')->sortable(); 65 $grid->column('updated_at')->sortable();
......
...@@ -71,7 +71,7 @@ class AdminMakeImmerse implements ShouldQueue ...@@ -71,7 +71,7 @@ class AdminMakeImmerse implements ShouldQueue
71 /** 音频视频轨都有 */ 71 /** 音频视频轨都有 */
72 if ($is_bgm) { 72 if ($is_bgm) {
73 // 有背景音 融合 73 // 有背景音 融合
74 - $audio = $this->getAbsolutePath($this->getTempPath('.mp3')); 74 + $audio = $this->getAbsolutePath($this->getTempPath('.mp3','audio'));
75 $cmd = $this->ffmpeg . 75 $cmd = $this->ffmpeg .
76 ' -y -i ' . escapeshellarg($file) . 76 ' -y -i ' . escapeshellarg($file) .
77 ' -y -i ' . escapeshellarg($bgm) . 77 ' -y -i ' . escapeshellarg($bgm) .
...@@ -89,7 +89,7 @@ class AdminMakeImmerse implements ShouldQueue ...@@ -89,7 +89,7 @@ class AdminMakeImmerse implements ShouldQueue
89 } elseif ($media_info['format']['nb_streams'] == 1) { 89 } elseif ($media_info['format']['nb_streams'] == 1) {
90 /** 只有视频轨 */ 90 /** 只有视频轨 */
91 // 生成一段无声音频 91 // 生成一段无声音频
92 - $audio = $this->getAbsolutePath($this->getTempPath('.mp3')); 92 + $audio = $this->getAbsolutePath($this->getTempPath('.mp3','audio'));
93 $cmd = $this->ffmpeg . 93 $cmd = $this->ffmpeg .
94 ' -y -f lavfi -i aevalsrc=0:duration=' . escapeshellarg($media_info['format']['duration']) . 94 ' -y -f lavfi -i aevalsrc=0:duration=' . escapeshellarg($media_info['format']['duration']) .
95 ' -ar 48000 -ab 64k ' . escapeshellarg($audio); 95 ' -ar 48000 -ab 64k ' . escapeshellarg($audio);
...@@ -114,7 +114,7 @@ class AdminMakeImmerse implements ShouldQueue ...@@ -114,7 +114,7 @@ class AdminMakeImmerse implements ShouldQueue
114 return; 114 return;
115 } 115 }
116 116
117 - $thumbnail = $this->getTempPath('.jpg',false); 117 + $thumbnail = $this->getTempPath('.jpg','thumbnail');
118 if ($adminMakeVideo->thumbnail == 2){ 118 if ($adminMakeVideo->thumbnail == 2){
119 // 截取中间帧作为视频封面 119 // 截取中间帧作为视频封面
120 $frame = ceil($media_info['streams'][0]['nb_frames'] / 2); 120 $frame = ceil($media_info['streams'][0]['nb_frames'] / 2);
...@@ -136,7 +136,7 @@ class AdminMakeImmerse implements ShouldQueue ...@@ -136,7 +136,7 @@ class AdminMakeImmerse implements ShouldQueue
136 if (!$this->execmd($cmd)) return ; 136 if (!$this->execmd($cmd)) return ;
137 } 137 }
138 138
139 - $output = $this->getTempPath('.mp4',false); 139 + $output = $this->getTempPath('.mp4','video');
140 $cmd = $this->ffmpeg . ' -y '. 140 $cmd = $this->ffmpeg . ' -y '.
141 ' -i ' . escapeshellarg($file). 141 ' -i ' . escapeshellarg($file).
142 ' -i ' . escapeshellarg($watermark). 142 ' -i ' . escapeshellarg($watermark).
...@@ -180,7 +180,7 @@ class AdminMakeImmerse implements ShouldQueue ...@@ -180,7 +180,7 @@ class AdminMakeImmerse implements ShouldQueue
180 180
181 if ($this->adminMakeVideo->type == 2 && !$is_bgm){ 181 if ($this->adminMakeVideo->type == 2 && !$is_bgm){
182 // 没有背景音,单图一张,输出为单图。 182 // 没有背景音,单图一张,输出为单图。
183 - $output = $this->getTempPath('.png',false); 183 + $output = $this->getTempPath('.png','thumbnail');
184 $cmd = $this->ffmpeg . ' -y '. 184 $cmd = $this->ffmpeg . ' -y '.
185 ' -i ' . escapeshellarg($image). 185 ' -i ' . escapeshellarg($image).
186 ' -i ' . escapeshellarg($watermark). 186 ' -i ' . escapeshellarg($watermark).
...@@ -191,7 +191,7 @@ class AdminMakeImmerse implements ShouldQueue ...@@ -191,7 +191,7 @@ class AdminMakeImmerse implements ShouldQueue
191 $thumbnail = $output; 191 $thumbnail = $output;
192 }else{ 192 }else{
193 // 有背景音 单图合成视频,时长为音频时长,音频加入背景音 193 // 有背景音 单图合成视频,时长为音频时长,音频加入背景音
194 - $output = $this->getTempPath('.mp4',false); 194 + $output = $this->getTempPath('.mp4','video');
195 195
196 // 分析背景音 196 // 分析背景音
197 $mediainfo = $this->mediainfo($bgm); 197 $mediainfo = $this->mediainfo($bgm);
...@@ -211,7 +211,7 @@ class AdminMakeImmerse implements ShouldQueue ...@@ -211,7 +211,7 @@ class AdminMakeImmerse implements ShouldQueue
211 escapeshellarg($this->getAbsolutePath($output)); 211 escapeshellarg($this->getAbsolutePath($output));
212 if (!$this->execmd($cmd)) return ; 212 if (!$this->execmd($cmd)) return ;
213 213
214 - $thumbnail = $this->getTempPath('.jpg',false); 214 + $thumbnail = $this->getTempPath('.jpg','thumbnail');
215 if ($adminMakeVideo->thumbnail == 2){ 215 if ($adminMakeVideo->thumbnail == 2){
216 // 将封面分辨率改为指定分辨率 216 // 将封面分辨率改为指定分辨率
217 $cmd = $this->ffmpeg . ' -y ' . 217 $cmd = $this->ffmpeg . ' -y ' .
...@@ -325,14 +325,13 @@ class AdminMakeImmerse implements ShouldQueue ...@@ -325,14 +325,13 @@ class AdminMakeImmerse implements ShouldQueue
325 /** 325 /**
326 * 获取输出临时文件名 326 * 获取输出临时文件名
327 * @param string $ext 327 * @param string $ext
328 - * @param bool $is_temp 328 + * @param string $dir
329 * @return string 329 * @return string
330 */ 330 */
331 - public function getTempPath($ext = '.mp4',$is_temp = true) 331 + public function getTempPath($ext = '.mp4',$dir = 'video')
332 { 332 {
333 $filename = "/output_" . time() . rand(0, 10000); 333 $filename = "/output_" . time() . rand(0, 10000);
334 334
335 - $prefix = $is_temp ? 'temp/' : 'video/';
336 $hash_hex = md5($filename); 335 $hash_hex = md5($filename);
337 // 16进制表示的字符串一共32字节,表示16个二进制字节。 336 // 16进制表示的字符串一共32字节,表示16个二进制字节。
338 // 前16个字符用来第一级求摸,后16个用做第二级 337 // 前16个字符用来第一级求摸,后16个用做第二级
...@@ -340,7 +339,7 @@ class AdminMakeImmerse implements ShouldQueue ...@@ -340,7 +339,7 @@ class AdminMakeImmerse implements ShouldQueue
340 $hash_hex_l2 = substr($hash_hex, 8, 8); 339 $hash_hex_l2 = substr($hash_hex, 8, 8);
341 $dir_l1 = hexdec($hash_hex_l1) % 256; 340 $dir_l1 = hexdec($hash_hex_l1) % 256;
342 $dir_l2 = hexdec($hash_hex_l2) % 512; 341 $dir_l2 = hexdec($hash_hex_l2) % 512;
343 - $dir = $prefix . $dir_l1 . '/' . $dir_l2; 342 + $dir = $dir . '/' . $dir_l1 . '/' . $dir_l2;
344 343
345 if( !Storage::disk('public')->exists($dir)) Storage::disk('public')->makeDirectory($dir); 344 if( !Storage::disk('public')->exists($dir)) Storage::disk('public')->makeDirectory($dir);
346 345
...@@ -373,7 +372,7 @@ class AdminMakeImmerse implements ShouldQueue ...@@ -373,7 +372,7 @@ class AdminMakeImmerse implements ShouldQueue
373 case 'every_poem': 372 case 'every_poem':
374 case 'one_poem': 373 case 'one_poem':
375 $content = $this->adminMakeVideo->poem->content; 374 $content = $this->adminMakeVideo->poem->content;
376 - $text_file = $this->getAbsolutePath($this->getTempPath('.txt')); 375 + $text_file = $this->getAbsolutePath($this->getTempPath('.txt','text'));
377 file_put_contents($text_file, $content); 376 file_put_contents($text_file, $content);
378 $drawtext .= 'drawtext="'. 377 $drawtext .= 'drawtext="'.
379 'fontfile=' . escapeshellarg($font_file) . ':' . 378 'fontfile=' . escapeshellarg($font_file) . ':' .
...@@ -389,9 +388,11 @@ class AdminMakeImmerse implements ShouldQueue ...@@ -389,9 +388,11 @@ class AdminMakeImmerse implements ShouldQueue
389 break; 388 break;
390 case 'weather': 389 case 'weather':
391 $content = $this->adminMakeVideo->weather; 390 $content = $this->adminMakeVideo->weather;
391 + $text_file = $this->getAbsolutePath($this->getTempPath('.txt','text'));
392 + file_put_contents($text_file, $content);
392 $drawtext .= 'drawtext="'. 393 $drawtext .= 'drawtext="'.
393 'fontfile=' . escapeshellarg($font_file) . ':' . 394 'fontfile=' . escapeshellarg($font_file) . ':' .
394 - 'text=' . escapeshellarg($content) . ':' . 395 + 'textfile=' . escapeshellarg($text_file) . ':' .
395 'fontsize=' . $this->calcFontSize($component->font_size) . ':' . 396 'fontsize=' . $this->calcFontSize($component->font_size) . ':' .
396 'fontcolor=' . $text_color . '@' . $opacity . ':' . 397 'fontcolor=' . $text_color . '@' . $opacity . ':' .
397 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . 398 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' .
...@@ -403,9 +404,11 @@ class AdminMakeImmerse implements ShouldQueue ...@@ -403,9 +404,11 @@ class AdminMakeImmerse implements ShouldQueue
403 break; 404 break;
404 case 'date': 405 case 'date':
405 $content = Carbon::now()->format('Y年m月d日H时'); 406 $content = Carbon::now()->format('Y年m月d日H时');
407 + $text_file = $this->getAbsolutePath($this->getTempPath('.txt','text'));
408 + file_put_contents($text_file, $content);
406 $drawtext .= 'drawtext="'. 409 $drawtext .= 'drawtext="'.
407 'fontfile=' . escapeshellarg($font_file) . ':' . 410 'fontfile=' . escapeshellarg($font_file) . ':' .
408 - 'text=' . escapeshellarg($content) . ':' . 411 + 'textfile=' . escapeshellarg($text_file) . ':' .
409 'fontsize=' . $this->calcFontSize($component->font_size) . ':' . 412 'fontsize=' . $this->calcFontSize($component->font_size) . ':' .
410 'fontcolor=' . $text_color . '@' . $opacity . ':' . 413 'fontcolor=' . $text_color . '@' . $opacity . ':' .
411 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . 414 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' .
...@@ -416,9 +419,11 @@ class AdminMakeImmerse implements ShouldQueue ...@@ -416,9 +419,11 @@ class AdminMakeImmerse implements ShouldQueue
416 break; 419 break;
417 case 'feel': 420 case 'feel':
418 $content = $this->adminMakeVideo->feel ?: '读此一言,仿佛身临其境。'; 421 $content = $this->adminMakeVideo->feel ?: '读此一言,仿佛身临其境。';
422 + $text_file = $this->getAbsolutePath($this->getTempPath('.txt','text'));
423 + file_put_contents($text_file, $content);
419 $drawtext .= 'drawtext="'. 424 $drawtext .= 'drawtext="'.
420 'fontfile=' . escapeshellarg($font_file) . ':' . 425 'fontfile=' . escapeshellarg($font_file) . ':' .
421 - 'text=' . escapeshellarg($content) . ':' . 426 + 'textfile=' . escapeshellarg($text_file) . ':' .
422 'fontsize=' . $this->calcFontSize($component->font_size) . ':' . 427 'fontsize=' . $this->calcFontSize($component->font_size) . ':' .
423 'fontcolor=' . $text_color . '@' . $opacity . ':' . 428 'fontcolor=' . $text_color . '@' . $opacity . ':' .
424 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . 429 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' .
......
...@@ -74,7 +74,7 @@ class UserMakeImmerse implements ShouldQueue ...@@ -74,7 +74,7 @@ class UserMakeImmerse implements ShouldQueue
74 74
75 // 音频还取之前的封面。 75 // 音频还取之前的封面。
76 $thumbnail = Storage::disk('public')->path($this->immerse->thumbnail); 76 $thumbnail = Storage::disk('public')->path($this->immerse->thumbnail);
77 - $video = Storage::disk('public')->path($this->getTempPath('.mp4',false)); 77 + $video = Storage::disk('public')->path($this->getTempPath('.mp4','video'));
78 78
79 if ($this->immerse->origin_video_url == '' || $this->immerse->origin_video_url == null) { 79 if ($this->immerse->origin_video_url == '' || $this->immerse->origin_video_url == null) {
80 // 原官方临境是图片 80 // 原官方临境是图片
...@@ -83,7 +83,7 @@ class UserMakeImmerse implements ShouldQueue ...@@ -83,7 +83,7 @@ class UserMakeImmerse implements ShouldQueue
83 if ($this->immerse->bgm == '' || $this->immerse->bgm == null) { 83 if ($this->immerse->bgm == '' || $this->immerse->bgm == null) {
84 $audio = $upload_file; 84 $audio = $upload_file;
85 }else{ 85 }else{
86 - $audio = Storage::disk('public')->path($this->getTempPath('.mp3')); 86 + $audio = Storage::disk('public')->path($this->getTempPath('.mp3','audio'));
87 $bgm = Storage::disk('public')->path($this->immerse->bgm); 87 $bgm = Storage::disk('public')->path($this->immerse->bgm);
88 $cmd = $this->ffmpeg . ' -y ' . 88 $cmd = $this->ffmpeg . ' -y ' .
89 ' -i ' . escapeshellarg($upload_file) . 89 ' -i ' . escapeshellarg($upload_file) .
...@@ -120,7 +120,7 @@ class UserMakeImmerse implements ShouldQueue ...@@ -120,7 +120,7 @@ class UserMakeImmerse implements ShouldQueue
120 //用户录音超长,截取用户录音 120 //用户录音超长,截取用户录音
121 if ($mediainfo['format']['duration'] > $origin_mediainfo['format']['duration']) { 121 if ($mediainfo['format']['duration'] > $origin_mediainfo['format']['duration']) {
122 if ($this->immerse->bgm == '' || $this->immerse->bgm == null) { 122 if ($this->immerse->bgm == '' || $this->immerse->bgm == null) {
123 - $audio = Storage::disk('public')->path($this->getTempPath('.mp3')); 123 + $audio = Storage::disk('public')->path($this->getTempPath('.mp3','audio'));
124 $cmd = $this->ffmpeg . ' -y ' . 124 $cmd = $this->ffmpeg . ' -y ' .
125 ' -i ' . escapeshellarg($upload_file) . 125 ' -i ' . escapeshellarg($upload_file) .
126 ' -ss 0 -t ' . escapeshellarg($origin_mediainfo['format']['duration']) . 126 ' -ss 0 -t ' . escapeshellarg($origin_mediainfo['format']['duration']) .
...@@ -128,7 +128,7 @@ class UserMakeImmerse implements ShouldQueue ...@@ -128,7 +128,7 @@ class UserMakeImmerse implements ShouldQueue
128 if (!$this->execmd($cmd)) return ; 128 if (!$this->execmd($cmd)) return ;
129 }else{ 129 }else{
130 $bgm = Storage::disk('public')->path($this->immerse->bgm); 130 $bgm = Storage::disk('public')->path($this->immerse->bgm);
131 - $audio = Storage::disk('public')->path($this->getTempPath('.mp3')); 131 + $audio = Storage::disk('public')->path($this->getTempPath('.mp3','audio'));
132 $cmd = $this->ffmpeg . ' -y ' . 132 $cmd = $this->ffmpeg . ' -y ' .
133 ' -i ' . escapeshellarg($upload_file) . 133 ' -i ' . escapeshellarg($upload_file) .
134 ' -i ' . escapeshellarg($bgm) . 134 ' -i ' . escapeshellarg($bgm) .
...@@ -141,7 +141,7 @@ class UserMakeImmerse implements ShouldQueue ...@@ -141,7 +141,7 @@ class UserMakeImmerse implements ShouldQueue
141 if ($this->immerse->bgm == '' || $this->immerse->bgm == null) { 141 if ($this->immerse->bgm == '' || $this->immerse->bgm == null) {
142 $audio = $upload_file; 142 $audio = $upload_file;
143 }else{ 143 }else{
144 - $audio = Storage::disk('public')->path($this->getTempPath('.mp3')); 144 + $audio = Storage::disk('public')->path($this->getTempPath('.mp3','audio'));
145 $bgm = Storage::disk('public')->path($this->immerse->bgm); 145 $bgm = Storage::disk('public')->path($this->immerse->bgm);
146 $cmd = $this->ffmpeg . ' -y ' . 146 $cmd = $this->ffmpeg . ' -y ' .
147 ' -i ' . escapeshellarg($upload_file) . 147 ' -i ' . escapeshellarg($upload_file) .
...@@ -209,7 +209,7 @@ class UserMakeImmerse implements ShouldQueue ...@@ -209,7 +209,7 @@ class UserMakeImmerse implements ShouldQueue
209 209
210 // 截取中间帧作为视频封面 210 // 截取中间帧作为视频封面
211 $frame = ceil($mediainfo['streams'][0]['nb_frames'] / 2); 211 $frame = ceil($mediainfo['streams'][0]['nb_frames'] / 2);
212 - $thumbnail = Storage::disk('public')->path($this->getTempPath('.jpg',false)); 212 + $thumbnail = Storage::disk('public')->path($this->getTempPath('.jpg','thumbnail'));
213 $cmd = $this->ffmpeg . ' -y ' . 213 $cmd = $this->ffmpeg . ' -y ' .
214 ' -i ' . escapeshellarg($upload_file) . 214 ' -i ' . escapeshellarg($upload_file) .
215 ' -i ' . escapeshellarg($watermark) . 215 ' -i ' . escapeshellarg($watermark) .
...@@ -219,7 +219,7 @@ class UserMakeImmerse implements ShouldQueue ...@@ -219,7 +219,7 @@ class UserMakeImmerse implements ShouldQueue
219 escapeshellarg($thumbnail); 219 escapeshellarg($thumbnail);
220 if (!$this->execmd($cmd)) return ; 220 if (!$this->execmd($cmd)) return ;
221 221
222 - $video = Storage::disk('public')->path($this->getTempPath('.mp4',false)); 222 + $video = Storage::disk('public')->path($this->getTempPath('.mp4','video'));
223 // 没有背景音 223 // 没有背景音
224 if ($this->immerse->bgm == '' || $this->immerse->bgm == null) { 224 if ($this->immerse->bgm == '' || $this->immerse->bgm == null) {
225 $cmd = $this->ffmpeg . ' -y ' . 225 $cmd = $this->ffmpeg . ' -y ' .
...@@ -325,14 +325,13 @@ class UserMakeImmerse implements ShouldQueue ...@@ -325,14 +325,13 @@ class UserMakeImmerse implements ShouldQueue
325 /** 325 /**
326 * 获取输出临时文件名 326 * 获取输出临时文件名
327 * @param string $ext 327 * @param string $ext
328 - * @param bool $is_temp 328 + * @param string $dir
329 * @return string 329 * @return string
330 */ 330 */
331 - public function getTempPath($ext = '.mp4',$is_temp = true) 331 + public function getTempPath($ext = '.mp4', $dir = 'video')
332 { 332 {
333 $filename = "/output_" . time() . rand(0, 10000); 333 $filename = "/output_" . time() . rand(0, 10000);
334 334
335 - $prefix = $is_temp ? 'temp/' : 'video/';
336 $hash_hex = md5($filename); 335 $hash_hex = md5($filename);
337 // 16进制表示的字符串一共32字节,表示16个二进制字节。 336 // 16进制表示的字符串一共32字节,表示16个二进制字节。
338 // 前16个字符用来第一级求摸,后16个用做第二级 337 // 前16个字符用来第一级求摸,后16个用做第二级
...@@ -340,7 +339,7 @@ class UserMakeImmerse implements ShouldQueue ...@@ -340,7 +339,7 @@ class UserMakeImmerse implements ShouldQueue
340 $hash_hex_l2 = substr($hash_hex, 8, 8); 339 $hash_hex_l2 = substr($hash_hex, 8, 8);
341 $dir_l1 = hexdec($hash_hex_l1) % 256; 340 $dir_l1 = hexdec($hash_hex_l1) % 256;
342 $dir_l2 = hexdec($hash_hex_l2) % 512; 341 $dir_l2 = hexdec($hash_hex_l2) % 512;
343 - $dir = $prefix . $dir_l1 . '/' . $dir_l2; 342 + $dir = $dir . '/' . $dir_l1 . '/' . $dir_l2;
344 343
345 if( !Storage::disk('public')->exists($dir)) Storage::disk('public')->makeDirectory($dir); 344 if( !Storage::disk('public')->exists($dir)) Storage::disk('public')->makeDirectory($dir);
346 345
...@@ -477,7 +476,7 @@ class UserMakeImmerse implements ShouldQueue ...@@ -477,7 +476,7 @@ class UserMakeImmerse implements ShouldQueue
477 $white = imagecolorallocate($wp, 0xDC, 0x14, 0x3C); //fixme 字体颜色 476 $white = imagecolorallocate($wp, 0xDC, 0x14, 0x3C); //fixme 字体颜色
478 imagettftext($wp, 20, 0, 75, 240, $white, $font, $signature); 477 imagettftext($wp, 20, 0, 75, 240, $white, $font, $signature);
479 478
480 - $dst = Storage::disk('public')->path($this->getTempPath('.png')); 479 + $dst = Storage::disk('public')->path($this->getTempPath('.png','temp'));
481 imagepng($wp, $dst); 480 imagepng($wp, $dst);
482 if(is_resource($end_wallpaper)) imagedestroy($end_wallpaper); 481 if(is_resource($end_wallpaper)) imagedestroy($end_wallpaper);
483 if(is_resource($_img)) imagedestroy($_img); 482 if(is_resource($_img)) imagedestroy($_img);
...@@ -504,7 +503,7 @@ class UserMakeImmerse implements ShouldQueue ...@@ -504,7 +503,7 @@ class UserMakeImmerse implements ShouldQueue
504 case 'every_poem': 503 case 'every_poem':
505 case 'one_poem': 504 case 'one_poem':
506 $content = $this->immerse->poem->content; 505 $content = $this->immerse->poem->content;
507 - $text_file = Storage::disk('public')->path($this->getTempPath('.txt')); 506 + $text_file = Storage::disk('public')->path($this->getTempPath('.txt','text'));
508 file_put_contents($text_file, $content); 507 file_put_contents($text_file, $content);
509 508
510 $text_color = $component->text_color ?? 'white'; 509 $text_color = $component->text_color ?? 'white';
...@@ -524,7 +523,7 @@ class UserMakeImmerse implements ShouldQueue ...@@ -524,7 +523,7 @@ class UserMakeImmerse implements ShouldQueue
524 break; 523 break;
525 case 'weather': 524 case 'weather':
526 $content = $this->immerse->weather; 525 $content = $this->immerse->weather;
527 - $text_file = Storage::disk('public')->path($this->getTempPath('.txt')); 526 + $text_file = Storage::disk('public')->path($this->getTempPath('.txt','text'));
528 file_put_contents($text_file, $content); 527 file_put_contents($text_file, $content);
529 $drawtext .= 'drawtext="'. 528 $drawtext .= 'drawtext="'.
530 'fontfile=' . escapeshellarg($font_file) . ':' . 529 'fontfile=' . escapeshellarg($font_file) . ':' .
...@@ -540,9 +539,11 @@ class UserMakeImmerse implements ShouldQueue ...@@ -540,9 +539,11 @@ class UserMakeImmerse implements ShouldQueue
540 break; 539 break;
541 case 'date': 540 case 'date':
542 $content = Carbon::now()->format('Y年m月d日H时'); 541 $content = Carbon::now()->format('Y年m月d日H时');
542 + $text_file = Storage::disk('public')->path($this->getTempPath('.txt','text'));
543 + file_put_contents($text_file, $content);
543 $drawtext .= 'drawtext="'. 544 $drawtext .= 'drawtext="'.
544 'fontfile=' . escapeshellarg($font_file) . ':' . 545 'fontfile=' . escapeshellarg($font_file) . ':' .
545 - 'text=' . escapeshellarg($content) . ':' . 546 + 'textfile=' . escapeshellarg($text_file) . ':' .
546 'fontsize=' . $this->calcFontSize($component->font_size) . ':' . 547 'fontsize=' . $this->calcFontSize($component->font_size) . ':' .
547 'fontcolor=' . $text_color . '@' . $opacity . ':' . 548 'fontcolor=' . $text_color . '@' . $opacity . ':' .
548 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . 549 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' .
...@@ -553,9 +554,11 @@ class UserMakeImmerse implements ShouldQueue ...@@ -553,9 +554,11 @@ class UserMakeImmerse implements ShouldQueue
553 break; 554 break;
554 case 'feel': 555 case 'feel':
555 $content = $this->immerse->content; 556 $content = $this->immerse->content;
557 + $text_file = Storage::disk('public')->path($this->getTempPath('.txt','text'));
558 + file_put_contents($text_file, $content);
556 $drawtext .= 'drawtext="'. 559 $drawtext .= 'drawtext="'.
557 'fontfile=' . escapeshellarg($font_file) . ':' . 560 'fontfile=' . escapeshellarg($font_file) . ':' .
558 - 'text=' . escapeshellarg($content) . ':' . 561 + 'textfile=' . escapeshellarg($text_file) . ':' .
559 'fontsize=' . $this->calcFontSize($component->font_size) . ':' . 562 'fontsize=' . $this->calcFontSize($component->font_size) . ':' .
560 'fontcolor=' . $text_color . '@' . $opacity . ':' . 563 'fontcolor=' . $text_color . '@' . $opacity . ':' .
561 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . 564 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' .
......