|
@@ -98,7 +98,7 @@ discard block |
|
|
block discarded – undo |
|
98
|
98
|
$subfolder = ''; |
|
99
|
99
|
|
|
100
|
100
|
// sub folder check |
|
101
|
|
- if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) { |
|
|
101
|
+ if (\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) { |
|
102
|
102
|
$subfolder = $filePath->folderPath; |
|
103
|
103
|
} |
|
104
|
104
|
|
|
@@ -106,7 +106,7 @@ discard block |
|
|
block discarded – undo |
|
106
|
106
|
$filePath = $this->getAssetPath($filePath); |
|
107
|
107
|
|
|
108
|
108
|
if (!empty($filePath)) { |
|
109
|
|
- $destVideoPath = $settings['transcoderPaths']['video'] . $subfolder ?? $settings['transcoderPaths']['default']; |
|
|
109
|
+ $destVideoPath = $settings['transcoderPaths']['video'].$subfolder ?? $settings['transcoderPaths']['default']; |
|
110
|
110
|
$destVideoPath = Craft::getAlias($destVideoPath); |
|
111
|
111
|
$videoOptions = $this->coalesceOptions('defaultVideoOptions', $videoOptions); |
|
112
|
112
|
|
|
@@ -198,7 +198,7 @@ discard block |
|
|
block discarded – undo |
|
198
|
198
|
|
|
199
|
199
|
// If the video file already exists and hasn't been modified, return it. Otherwise, start it transcoding |
|
200
|
200
|
if (file_exists($destVideoPath) && (@filemtime($destVideoPath) >= @filemtime($filePath))) { |
|
201
|
|
- $url = $settings['transcoderUrls']['video'] . $subfolder ?? $settings['transcoderUrls']['default']; |
|
|
201
|
+ $url = $settings['transcoderUrls']['video'].$subfolder ?? $settings['transcoderUrls']['default']; |
|
202
|
202
|
$result = Craft::getAlias($url).$destVideoFile; |
|
203
|
203
|
|
|
204
|
204
|
// skip encoding |
|
@@ -235,14 +235,14 @@ discard block |
|
|
block discarded – undo |
|
235
|
235
|
$subfolder = ''; |
|
236
|
236
|
|
|
237
|
237
|
// sub folder check |
|
238
|
|
- if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) { |
|
|
238
|
+ if (\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) { |
|
239
|
239
|
$subfolder = $filePath->folderPath; |
|
240
|
240
|
} |
|
241
|
241
|
|
|
242
|
242
|
$filePath = $this->getAssetPath($filePath); |
|
243
|
243
|
|
|
244
|
244
|
if (!empty($filePath)) { |
|
245
|
|
- $destThumbnailPath = $settings['transcoderPaths']['thumbnail'] . $subfolder ?? $settings['transcoderPaths']['default']; |
|
|
245
|
+ $destThumbnailPath = $settings['transcoderPaths']['thumbnail'].$subfolder ?? $settings['transcoderPaths']['default']; |
|
246
|
246
|
$destThumbnailPath = Craft::getAlias($destThumbnailPath); |
|
247
|
247
|
|
|
248
|
248
|
$thumbnailOptions = $this->coalesceOptions('defaultThumbnailOptions', $thumbnailOptions); |
|
@@ -303,7 +303,7 @@ discard block |
|
|
block discarded – undo |
|
303
|
303
|
if ($asPath) { |
|
304
|
304
|
$result = $destThumbnailPath; |
|
305
|
305
|
} else { |
|
306
|
|
- $url = $settings['transcoderUrls']['thumbnail'] . $subfolder ?? $settings['transcoderUrls']['default']; |
|
|
306
|
+ $url = $settings['transcoderUrls']['thumbnail'].$subfolder ?? $settings['transcoderUrls']['default']; |
|
307
|
307
|
$result = Craft::getAlias($url).$destThumbnailFile; |
|
308
|
308
|
} |
|
309
|
309
|
} |
|
@@ -328,14 +328,14 @@ discard block |
|
|
block discarded – undo |
|
328
|
328
|
$subfolder = ''; |
|
329
|
329
|
|
|
330
|
330
|
// sub folder check |
|
331
|
|
- if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) { |
|
|
331
|
+ if (\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) { |
|
332
|
332
|
$subfolder = $filePath->folderPath; |
|
333
|
333
|
} |
|
334
|
334
|
|
|
335
|
335
|
$filePath = $this->getAssetPath($filePath); |
|
336
|
336
|
|
|
337
|
337
|
if (!empty($filePath)) { |
|
338
|
|
- $destAudioPath = $settings['transcoderPaths']['audio'] . $subfolder ?? $settings['transcoderPaths']['default']; |
|
|
338
|
+ $destAudioPath = $settings['transcoderPaths']['audio'].$subfolder ?? $settings['transcoderPaths']['default']; |
|
339
|
339
|
$destAudioPath = Craft::getAlias($destAudioPath); |
|
340
|
340
|
|
|
341
|
341
|
$audioOptions = $this->coalesceOptions('defaultAudioOptions', $audioOptions); |
|
@@ -409,13 +409,13 @@ discard block |
|
|
block discarded – undo |
|
409
|
409
|
|
|
410
|
410
|
// If the audio file already exists and hasn't been modified, return it. Otherwise, start it transcoding |
|
411
|
411
|
if (file_exists($destAudioPath) && (@filemtime($destAudioPath) >= @filemtime($filePath))) { |
|
412
|
|
- $url = $settings['transcoderUrls']['audio'] . $subfolder ?? $settings['transcoderUrls']['default']; |
|
|
412
|
+ $url = $settings['transcoderUrls']['audio'].$subfolder ?? $settings['transcoderUrls']['default']; |
|
413
|
413
|
$result = Craft::getAlias($url).$destAudioFile; |
|
414
|
414
|
} else { |
|
415
|
415
|
// Kick off the transcoding |
|
416
|
416
|
Craft::info($ffmpegCmd, __METHOD__); |
|
417
|
417
|
$this->executeShellCommand($ffmpegCmd); |
|
418
|
|
- $url = $settings['transcoderUrls']['audio'] . $subfolder ?? $settings['transcoderUrls']['default']; |
|
|
418
|
+ $url = $settings['transcoderUrls']['audio'].$subfolder ?? $settings['transcoderUrls']['default']; |
|
419
|
419
|
$result = Craft::getAlias($url).$destAudioFile; |
|
420
|
420
|
Craft::info($result, __METHOD__); |
|
421
|
421
|
|
|
@@ -489,7 +489,7 @@ discard block |
|
|
block discarded – undo |
|
489
|
489
|
&& (strpos($summaryResult['videoFrameRate'], '/') !== false) |
|
490
|
490
|
) { |
|
491
|
491
|
$parts = explode('/', $summaryResult['videoFrameRate']); |
|
492
|
|
- $summaryResult['videoFrameRate'] = (float)$parts[0] / (float)$parts[1]; |
|
|
492
|
+ $summaryResult['videoFrameRate'] = (float) $parts[0] / (float) $parts[1]; |
|
493
|
493
|
} |
|
494
|
494
|
$result = $summaryResult; |
|
495
|
495
|
} |
|
@@ -601,7 +601,7 @@ discard block |
|
|
block discarded – undo |
|
601
|
601
|
$subfolder = ''; |
|
602
|
602
|
|
|
603
|
603
|
// sub folder check |
|
604
|
|
- if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) { |
|
|
604
|
+ if (\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) { |
|
605
|
605
|
$subfolder = $filePath->folderPath; |
|
606
|
606
|
} |
|
607
|
607
|
|
|
@@ -609,7 +609,7 @@ discard block |
|
|
block discarded – undo |
|
609
|
609
|
|
|
610
|
610
|
if (!empty($filePath)) { |
|
611
|
611
|
// Dest path |
|
612
|
|
- $destVideoPath = $settings['transcoderPaths']['gif'] . $subfolder ?? $settings['transcoderPaths']['default']; |
|
|
612
|
+ $destVideoPath = $settings['transcoderPaths']['gif'].$subfolder ?? $settings['transcoderPaths']['default']; |
|
613
|
613
|
$destVideoPath = Craft::getAlias($destVideoPath); |
|
614
|
614
|
|
|
615
|
615
|
// Options |
|
@@ -663,7 +663,7 @@ discard block |
|
|
block discarded – undo |
|
663
|
663
|
|
|
664
|
664
|
// If the video file already exists and hasn't been modified, return it. Otherwise, start it transcoding |
|
665
|
665
|
if (file_exists($destVideoPath) && (@filemtime($destVideoPath) >= @filemtime($filePath))) { |
|
666
|
|
- $url = $settings['transcoderUrls']['gif'] . $subfolder ?? $settings['transcoderUrls']['default']; |
|
|
666
|
+ $url = $settings['transcoderUrls']['gif'].$subfolder ?? $settings['transcoderUrls']['default']; |
|
667
|
667
|
$result = Craft::getAlias($url).$destVideoFile; |
|
668
|
668
|
} else { |
|
669
|
669
|
// Kick off the transcoding |
|
@@ -749,14 +749,14 @@ discard block |
|
|
block discarded – undo |
|
749
|
749
|
// If it's local, get a path to the file |
|
750
|
750
|
if ($assetVolume instanceof Local) { |
|
751
|
751
|
$sourcePath = rtrim($assetVolume->path, DIRECTORY_SEPARATOR); |
|
752
|
|
- $sourcePath .= '' === $sourcePath ? '': DIRECTORY_SEPARATOR; |
|
|
752
|
+ $sourcePath .= '' === $sourcePath ? '' : DIRECTORY_SEPARATOR; |
|
753
|
753
|
$folderPath = ''; |
|
754
|
754
|
try { |
|
755
|
755
|
$folderPath = rtrim($asset->getFolder()->path, DIRECTORY_SEPARATOR); |
|
756
|
756
|
} catch (InvalidConfigException $e) { |
|
757
|
757
|
Craft::error($e->getMessage(), __METHOD__); |
|
758
|
758
|
} |
|
759
|
|
- $folderPath .= '' === $folderPath ? '': DIRECTORY_SEPARATOR; |
|
|
759
|
+ $folderPath .= '' === $folderPath ? '' : DIRECTORY_SEPARATOR; |
|
760
|
760
|
|
|
761
|
761
|
$filePath = $sourcePath.$folderPath.$asset->filename; |
|
762
|
762
|
} else { |