add per-trip videos and audio clips
This commit is contained in:
parent
462c6883e2
commit
b9395cf5e3
2 changed files with 15 additions and 10 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -2,8 +2,8 @@
|
||||||
/public/build
|
/public/build
|
||||||
/public/hot
|
/public/hot
|
||||||
/public/storage
|
/public/storage
|
||||||
/public/videos
|
/public/*/videos
|
||||||
/public/audio
|
/public/*/audio
|
||||||
/storage/*.key
|
/storage/*.key
|
||||||
/vendor
|
/vendor
|
||||||
.env
|
.env
|
||||||
|
|
|
@ -6,13 +6,16 @@
|
||||||
if (preg_match("/\[\[([^\]]+)\]\]/", $checkin->note, $filepath)) {
|
if (preg_match("/\[\[([^\]]+)\]\]/", $checkin->note, $filepath)) {
|
||||||
if (preg_match("/\.webm/", $filepath[1])) {
|
if (preg_match("/\.webm/", $filepath[1])) {
|
||||||
$hasEmbed = 'video';
|
$hasEmbed = 'video';
|
||||||
if (file_exists(public_path() . "/videos/" . $filepath[1])) {
|
$trip_slug = preg_replace( '/[^A-Za-z0-9-]+/', '-', strtolower( $trip->name ) );
|
||||||
|
if (file_exists(public_path() . "/" . $trip_slug . "/" . $hasEmbed . "/" . $filepath[1])) {
|
||||||
|
$path = "/" . $trip_slug . "/" .$hasEmbed . "/" . $filepath[1];
|
||||||
|
|
||||||
$embed = '<video class="popup__video" controls>';
|
$embed = '<video class="popup__video" controls>';
|
||||||
$embed .= '<source src="' . url("/videos/" . $filepath[1]) . '" type="video/webm">';
|
$embed .= '<source src="' . url( $path ) . '" type="video/webm">';
|
||||||
$embed .= '<p>Your client doesn\'t support HTML video. Here is a <a href="' . url("/videos/" . $filepath[1]) . '">link to the video</a> instead.</p>';
|
$embed .= '<p>Your client doesn\'t support HTML video. Here is a <a href="' . url( $path ) . '">link to the video</a> instead.</p>';
|
||||||
$embed .= '</video>';
|
$embed .= '</video>';
|
||||||
if (isset($email)) {
|
if (isset($email)) {
|
||||||
$embed .= '<p><i>If your email client doesn\'t support video embeds, here is a <a href="' . url("/videos/" . $filepath[1]) . '">link to the file</a> instead.</i></p>';
|
$embed .= '<p><i>If your email client doesn\'t support video embeds, here is a <a href="' . url( $path ) . '">link to the file</a> instead.</i></p>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$embed = '<p>[The video \'' . $filepath[1] . '\' has not yet been uploaded, try again later.]</p>';
|
$embed = '<p>[The video \'' . $filepath[1] . '\' has not yet been uploaded, try again later.]</p>';
|
||||||
|
@ -20,13 +23,15 @@
|
||||||
}
|
}
|
||||||
} elseif (preg_match("/\.ogg/", $filepath[1])) {
|
} elseif (preg_match("/\.ogg/", $filepath[1])) {
|
||||||
$hasEmbed = 'audio';
|
$hasEmbed = 'audio';
|
||||||
if (file_exists(public_path() . "/audio/" . $filepath[1])) {
|
if (file_exists(public_path() . "/" . $trip_slug . "/" . $hasEmbed . "/" . $filepath[1])) {
|
||||||
|
$path = "/" . $trip_slug . "/" .$hasEmbed . "/" . $filepath[1];
|
||||||
|
|
||||||
$embed = '<audio class="popup__audio" controls>';
|
$embed = '<audio class="popup__audio" controls>';
|
||||||
$embed .= '<source src="' . url("/audio/" . $filepath[1]) . '" type="audio/ogg">';
|
$embed .= '<source src="' . url( $path ) . '" type="audio/ogg">';
|
||||||
$embed .= '<p>Download <a href="' . url("/audio/" . $filepath[1]) . '">OGG</a> audio.</p>';
|
$embed .= '<p>Download <a href="' . url( $path ) . '">OGG</a> audio.</p>';
|
||||||
$embed .= '</audio>';
|
$embed .= '</audio>';
|
||||||
if (isset($email)) {
|
if (isset($email)) {
|
||||||
$embed .= '<p><i>If your email client doesn\' support audio embeds, here is a <a href="' . url("/audio/" . $filepath[1]) . '">link to the file</a> instead.</i></p>';
|
$embed .= '<p><i>If your email client doesn\' support audio embeds, here is a <a href="' . url( $path ) . '">link to the file</a> instead.</i></p>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$embed = '<p>[The recording \'' . $filepath[1] . '\' has not yet been uploaded, try again later.]</p>';
|
$embed = '<p>[The recording \'' . $filepath[1] . '\' has not yet been uploaded, try again later.]</p>';
|
||||||
|
|
Loading…
Reference in a new issue