diff --git a/.gitignore b/.gitignore index adaa8c9..ef90320 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,8 @@ /public/build /public/hot /public/storage -/public/videos -/public/audio +/public/*/videos +/public/*/audio /storage/*.key /vendor .env diff --git a/resources/views/partials/checkins-list.blade.php b/resources/views/partials/checkins-list.blade.php index 0ebc3e6..e45fdb2 100644 --- a/resources/views/partials/checkins-list.blade.php +++ b/resources/views/partials/checkins-list.blade.php @@ -6,13 +6,16 @@ if (preg_match("/\[\[([^\]]+)\]\]/", $checkin->note, $filepath)) { if (preg_match("/\.webm/", $filepath[1])) { $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 = ''; if (isset($email)) { - $embed .= '

If your email client doesn\'t support video embeds, here is a link to the file instead.

'; + $embed .= '

If your email client doesn\'t support video embeds, here is a link to the file instead.

'; } } else { $embed = '

[The video \'' . $filepath[1] . '\' has not yet been uploaded, try again later.]

'; @@ -20,13 +23,15 @@ } } elseif (preg_match("/\.ogg/", $filepath[1])) { $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 = ''; if (isset($email)) { - $embed .= '

If your email client doesn\' support audio embeds, here is a link to the file instead.

'; + $embed .= '

If your email client doesn\' support audio embeds, here is a link to the file instead.

'; } } else { $embed = '

[The recording \'' . $filepath[1] . '\' has not yet been uploaded, try again later.]

';