@@ -113,7 +113,8 @@ public function getVideoUrl(string|Asset $filePath, array $videoOptions, bool $g
113
113
$ filePath = $ this ->getAssetPath ($ filePath );
114
114
115
115
if (!empty ($ filePath )) {
116
- $ destVideoPath = $ settings ['transcoderPaths ' ]['video ' ] . $ subfolder ?? $ settings ['transcoderPaths ' ]['default ' ];
116
+ $ destVideoPath = $ settings ['transcoderPaths ' ]['video ' ] ?? $ settings ['transcoderPaths ' ]['default ' ];
117
+ $ destVideoPath .= $ subfolder ;
117
118
$ destVideoPath = App::parseEnv ($ destVideoPath );
118
119
$ videoOptions = $ this ->coalesceOptions ('defaultVideoOptions ' , $ videoOptions );
119
120
@@ -207,7 +208,8 @@ public function getVideoUrl(string|Asset $filePath, array $videoOptions, bool $g
207
208
208
209
// If the video file already exists and hasn't been modified, return it. Otherwise, start it transcoding
209
210
if (file_exists ($ destVideoPath ) && (@filemtime ($ destVideoPath ) >= @filemtime ($ filePath ))) {
210
- $ url = $ settings ['transcoderUrls ' ]['video ' ] . $ subfolder ?? $ settings ['transcoderUrls ' ]['default ' ];
211
+ $ url = $ settings ['transcoderUrls ' ]['video ' ] ?? $ settings ['transcoderUrls ' ]['default ' ];
212
+ $ url .= $ subfolder ;
211
213
$ result = App::parseEnv ($ url ) . $ destVideoFile ;
212
214
// skip encoding
213
215
} elseif (!$ generate ) {
@@ -251,7 +253,8 @@ public function getVideoThumbnailUrl(Asset|string $filePath, array $thumbnailOpt
251
253
$ filePath = $ this ->getAssetPath ($ filePath );
252
254
253
255
if (!empty ($ filePath )) {
254
- $ destThumbnailPath = $ settings ['transcoderPaths ' ]['thumbnail ' ] . $ subfolder ?? $ settings ['transcoderPaths ' ]['default ' ];
256
+ $ destThumbnailPath = $ settings ['transcoderPaths ' ]['thumbnail ' ] ?? $ settings ['transcoderPaths ' ]['default ' ];
257
+ $ destThumbnailPath .= $ subfolder ;
255
258
$ destThumbnailPath = App::parseEnv ($ destThumbnailPath );
256
259
257
260
$ thumbnailOptions = $ this ->coalesceOptions ('defaultThumbnailOptions ' , $ thumbnailOptions );
@@ -309,7 +312,8 @@ public function getVideoThumbnailUrl(Asset|string $filePath, array $thumbnailOpt
309
312
if ($ asPath ) {
310
313
$ result = $ destThumbnailPath ;
311
314
} else {
312
- $ url = $ settings ['transcoderUrls ' ]['thumbnail ' ] . $ subfolder ?? $ settings ['transcoderUrls ' ]['default ' ];
315
+ $ url = $ settings ['transcoderUrls ' ]['thumbnail ' ] ?? $ settings ['transcoderUrls ' ]['default ' ];
316
+ $ url .= $ subfolder ;
313
317
$ result = App::parseEnv ($ url ) . $ destThumbnailFile ;
314
318
}
315
319
}
@@ -341,7 +345,8 @@ public function getAudioUrl(Asset|string $filePath, array $audioOptions): string
341
345
$ filePath = $ this ->getAssetPath ($ filePath );
342
346
343
347
if (!empty ($ filePath )) {
344
- $ destAudioPath = $ settings ['transcoderPaths ' ]['audio ' ] . $ subfolder ?? $ settings ['transcoderPaths ' ]['default ' ];
348
+ $ destAudioPath = $ settings ['transcoderPaths ' ]['audio ' ] ?? $ settings ['transcoderPaths ' ]['default ' ];
349
+ $ destAudioPath .= $ subfolder ;
345
350
$ destAudioPath = App::parseEnv ($ destAudioPath );
346
351
347
352
$ audioOptions = $ this ->coalesceOptions ('defaultAudioOptions ' , $ audioOptions );
@@ -436,15 +441,17 @@ public function getAudioUrl(Asset|string $filePath, array $audioOptions): string
436
441
437
442
// If the audio file already exists and hasn't been modified, return it. Otherwise, start it transcoding
438
443
if (file_exists ($ destAudioPath ) && (@filemtime ($ destAudioPath ) >= @filemtime ($ filePath ))) {
439
- $ url = $ settings ['transcoderUrls ' ]['audio ' ] . $ subfolder ?? $ settings ['transcoderUrls ' ]['default ' ];
444
+ $ url = $ settings ['transcoderUrls ' ]['audio ' ] ?? $ settings ['transcoderUrls ' ]['default ' ];
445
+ $ url .= $ subfolder ;
440
446
$ result = App::parseEnv ($ url ) . $ destAudioFile ;
441
447
} else {
442
448
// Kick off the transcoding
443
449
$ pid = $ this ->executeShellCommand ($ ffmpegCmd );
444
450
445
451
if ($ synchronous ) {
446
452
Craft::info ($ ffmpegCmd , __METHOD__ );
447
- $ url = $ settings ['transcoderUrls ' ]['audio ' ] . $ subfolder ?? $ settings ['transcoderUrls ' ]['default ' ];
453
+ $ url = $ settings ['transcoderUrls ' ]['audio ' ] ?? $ settings ['transcoderUrls ' ]['default ' ];
454
+ $ url .= $ subfolder ;
448
455
$ result = App::parseEnv ($ url ) . $ destAudioFile ;
449
456
} else {
450
457
Craft::info ($ ffmpegCmd . "\nffmpeg PID: " . $ pid , __METHOD__ );
@@ -646,7 +653,8 @@ public function getGifUrl(Asset|string $filePath, array $gifOptions): string|fal
646
653
647
654
if (!empty ($ filePath )) {
648
655
// Dest path
649
- $ destVideoPath = $ settings ['transcoderPaths ' ]['gif ' ] . $ subfolder ?? $ settings ['transcoderPaths ' ]['default ' ];
656
+ $ destVideoPath = $ settings ['transcoderPaths ' ]['gif ' ] ?? $ settings ['transcoderPaths ' ]['default ' ];
657
+ $ destVideoPath .= $ subfolder ;
650
658
$ destVideoPath = App::parseEnv ($ destVideoPath );
651
659
652
660
// Options
@@ -702,7 +710,8 @@ public function getGifUrl(Asset|string $filePath, array $gifOptions): string|fal
702
710
703
711
// If the video file already exists and hasn't been modified, return it. Otherwise, start it transcoding
704
712
if (file_exists ($ destVideoPath ) && (@filemtime ($ destVideoPath ) >= @filemtime ($ filePath ))) {
705
- $ url = $ settings ['transcoderUrls ' ]['gif ' ] . $ subfolder ?? $ settings ['transcoderUrls ' ]['default ' ];
713
+ $ url = $ settings ['transcoderUrls ' ]['gif ' ] ?? $ settings ['transcoderUrls ' ]['default ' ];
714
+ $ url .= $ subfolder ;
706
715
$ result = App::parseEnv ($ url ) . $ destVideoFile ;
707
716
} else {
708
717
// Kick off the transcoding
0 commit comments