Add support for MP4 uploads

Resolves #100
This commit is contained in:
Trevor Slocum 2020-06-02 16:14:44 -07:00
parent 94277f4625
commit ec08da093a
5 changed files with 13 additions and 8 deletions

View File

@ -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"
</IfModule>

View File

@ -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.

View File

@ -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)));

View File

@ -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 = "<a href=\"$direct_link\" onclick=\"return expandFile(event, '${post['id']}');\"><img src=\"" . ($res == TINYIB_RESPAGE ? "../" : "") . "src/${post["file"]}\" width=\"${post["image_width"]}\" style=\"max-width: 100%;height: auto;\"></a>";
}
$thumblink = "<a href=\"$direct_link\" target=\"_blank\"" . ((isEmbed($post["file_hex"]) || in_array(substr($post['file'], -4), array('.jpg', '.png', '.gif', 'webm'))) ? " onclick=\"return expandFile(event, '${post['id']}');\"" : "") . ">";
$thumblink = "<a href=\"$direct_link\" target=\"_blank\"" . ((isEmbed($post["file_hex"]) || in_array(substr($post['file'], -4), array('.jpg', '.png', '.gif', 'webm', '.mp4'))) ? " onclick=\"return expandFile(event, '${post['id']}');\"" : "") . ">";
$expandhtml = rawurlencode($expandhtml);
if (isEmbed($post["file_hex"])) {

View File

@ -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