Skip to content

Commit 9f00019

Browse files
committed
Added support for Yii2 aliases for transcoderPath & transcoderUrl settings in config.php
Signed-off-by: Andrew Welch <andrew@nystudio107.com>
1 parent 9220bfe commit 9f00019

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/services/Transcode.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function getVideoUrl($filePath, $videoOptions): string
9393
$filePath = $this->getAssetPath($filePath);
9494

9595
if (file_exists($filePath)) {
96-
$destVideoPath = $settings['transcoderPath'];
96+
$destVideoPath = Craft::getAlias($settings['transcoderPath']);
9797

9898
$videoOptions = $this->coalesceOptions("defaultVideoOptions", $videoOptions);
9999

@@ -181,7 +181,7 @@ public function getVideoUrl($filePath, $videoOptions): string
181181

182182
// If the video file already exists and hasn't been modified, return it. Otherwise, start it transcoding
183183
if (file_exists($destVideoPath) && (filemtime($destVideoPath) >= filemtime($filePath))) {
184-
$result = $settings['transcoderUrl'] . $destVideoFile;
184+
$result = Craft::getAlias($settings['transcoderUrl']) . $destVideoFile;
185185
} else {
186186
// Kick off the transcoding
187187
$pid = $this->executeShellCommand($ffmpegCmd);
@@ -212,7 +212,7 @@ public function getVideoThumbnailUrl($filePath, $thumbnailOptions): string
212212
$filePath = $this->getAssetPath($filePath);
213213

214214
if (file_exists($filePath)) {
215-
$destThumbnailPath = $settings['transcoderPath'];
215+
$destThumbnailPath = Craft::getAlias($settings['transcoderPath']);
216216

217217
$thumbnailOptions = $this->coalesceOptions("defaultThumbnailOptions", $thumbnailOptions);
218218

@@ -250,7 +250,7 @@ public function getVideoThumbnailUrl($filePath, $thumbnailOptions): string
250250
$shellOutput = $this->executeShellCommand($ffmpegCmd);
251251
Craft::info($ffmpegCmd, __METHOD__);
252252
}
253-
$result = $settings['transcoderUrl'] . $destThumbnailFile;
253+
$result = Craft::getAlias($settings['transcoderUrl']) . $destThumbnailFile;
254254
}
255255

256256
return $result;
@@ -274,7 +274,7 @@ public function getAudioUrl($filePath, $audioOptions): string
274274
$filePath = $this->getAssetPath($filePath);
275275

276276
if (file_exists($filePath)) {
277-
$destAudioPath = $settings['transcoderPath'];
277+
$destAudioPath = Craft::getAlias($settings['transcoderPath']);
278278

279279
$audioOptions = $this->coalesceOptions("defaultAudioOptions", $audioOptions);
280280

@@ -339,7 +339,7 @@ public function getAudioUrl($filePath, $audioOptions): string
339339

340340
// If the audio file already exists and hasn't been modified, return it. Otherwise, start it transcoding
341341
if (file_exists($destAudioPath) && (filemtime($destAudioPath) >= filemtime($filePath))) {
342-
$result = $settings['transcoderUrl'] . $destAudioFile;
342+
$result = Craft::getAlias($settings['transcoderUrl']) . $destAudioFile;
343343
} else {
344344
// Kick off the transcoding
345345
$pid = $this->executeShellCommand($ffmpegCmd);

0 commit comments

Comments
 (0)