diff --git a/.htaccess b/.htaccess index 1e3309a..683ac24 100644 --- a/.htaccess +++ b/.htaccess @@ -23,6 +23,8 @@ ExpiresByType image/jpeg "access plus 2592000 seconds" ExpiresByType image/png "access plus 2592000 seconds" ExpiresByType audio/webm "access plus 2592000 seconds" ExpiresByType video/webm "access plus 2592000 seconds" +ExpiresByType audio/mp4 "access plus 2592000 seconds" +ExpiresByType video/mp4 "access plus 2592000 seconds" ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds" diff --git a/README.md b/README.md index 7387771..33556ef 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Features **Not looking for an image board script?** TinyIB is able to allow new threads without requiring an image, or even disallow images entirely. See the [Text Board Mode](https://gitlab.com/tslocum/tinyib/wikis/Text-Board-Mode) wiki page for instructions. - - GIF, JPG, PNG, SWF and WebM upload. + - GIF, JPG, PNG, SWF, MP4 and WebM upload. - YouTube, Vimeo and SoundCloud embedding. - CAPTCHA (A simple implementation is included, reCAPTCHA is also supported) - Reference links >>### @@ -44,9 +44,10 @@ Installing - Set ``TINYIB_REQMOD`` to ``files`` to require moderation for posts with files attached. - Set ``TINYIB_REQMOD`` to ``all`` to require moderation for all posts. - Moderate posts by visiting the management panel. - - To allow WebM upload: + - To allow video uploads: - Ensure your web host is running Linux. - Install [mediainfo](https://mediaarea.net/en/MediaInfo) and [ffmpegthumbnailer](https://code.google.com/p/ffmpegthumbnailer/). On Ubuntu, run ``sudo apt-get install mediainfo ffmpegthumbnailer``. + - Add desired video file types to ``$tinyib_uploads``. - To remove the play icon from .SWF and .WebM thumbnails, delete or rename **video_overlay.png** - To use ImageMagick instead of GD when creating thumbnails: - Install ImageMagick and ensure that the ``convert`` command is available. diff --git a/imgboard.php b/imgboard.php index cfb21fb..c70047c 100644 --- a/imgboard.php +++ b/imgboard.php @@ -215,7 +215,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) fancyDie("File transfer failure. Please go back and try again."); } - if ($file_mime == "audio/webm" || $file_mime == "video/webm") { + if ($file_mime == "audio/webm" || $file_mime == "video/webm" || $file_mime == "audio/mp4" || $file_mime == "video/mp4") { $post['image_width'] = max(0, intval(shell_exec('mediainfo --Inform="Video;%Width%" ' . $file_location))); $post['image_height'] = max(0, intval(shell_exec('mediainfo --Inform="Video;%Height%" ' . $file_location))); diff --git a/inc/html.php b/inc/html.php index 832d6c0..5ca0351 100644 --- a/inc/html.php +++ b/inc/html.php @@ -351,7 +351,7 @@ function buildPost($post, $res) { if (isEmbed($post["file_hex"])) { $expandhtml = $post['file']; - } else if (substr($post['file'], -5) == '.webm') { + } else if (substr($post['file'], -5) == '.webm' || substr($post['file'], -4) == '.mp4') { $dimensions = 'width="500" height="50"'; if ($post['image_width'] > 0 && $post['image_height'] > 0) { $dimensions = 'width="' . $post['image_width'] . '" height="' . $post['image_height'] . '"'; @@ -365,7 +365,7 @@ EOF; $expandhtml = ""; } - $thumblink = ""; + $thumblink = ""; $expandhtml = rawurlencode($expandhtml); if (isEmbed($post["file_hex"])) { diff --git a/settings.default.php b/settings.default.php index fab294f..9abc5b4 100644 --- a/settings.default.php +++ b/settings.default.php @@ -42,9 +42,11 @@ $tinyib_uploads = array('image/jpeg' => array('jpg'), 'image/pjpeg' => array('jpg'), 'image/png' => array('png'), 'image/gif' => array('gif')); -# 'application/x-shockwave-flash' => array('swf', 'swf_thumbnail.png')); -# 'video/webm' => array('webm')); // WebM upload requires mediainfo and ffmpegthumbnailer (see README for instructions) -# 'audio/webm' => array('webm')); +# 'application/x-shockwave-flash' => array('swf', 'swf_thumbnail.png'); +# 'video/webm' => array('webm'); // Video uploads require mediainfo and ffmpegthumbnailer (see README for instructions) +# 'audio/webm' => array('webm'); +# 'video/mp4' => array('mp4'); +# 'audio/mp4' => array('mp4'); // oEmbed APIs // Empty array to disable