2018-08-24, 03:07 PM
2018-08-24, 08:58 PM
2018-08-25, 05:39 AM
Changing the file extension on a file upon uploading may render the file useless. Remember, a file extension is theoretically just a "label". You can change the label on something but that doesn't alter the product or thing you're attempting to change.
If you want mp4 files and other various formats with smaller sizes it's probably best to force it on your users in ACP > Configuration > Attachment types. Additionally, as suggested above use an external image host.
If you want mp4 files and other various formats with smaller sizes it's probably best to force it on your users in ACP > Configuration > Attachment types. Additionally, as suggested above use an external image host.
2018-08-25, 01:26 PM
upload.attachemnt.php
function upload_attachment($attachment, $update_attachment=false)
.
.
.
//when gif file
$filename = "post_".$mybb->user['uid']."_".TIME_NOW."_".md5(random_str()).".attach";
$filename = preg_replace('"\.attach$"', '.mp4', $filename);
$ffmpeg = "/usr/bin/ffmpeg";
$gifFile = $attachment['tmp_name'];
$output = $mybb->settings['uploadspath']."/".$month_dir."/".$filename;
$cmd = "$ffmpeg -i $gifFile -movflags faststart -pix_fmt yuv420p -vf \"scale=trunc(iw/2)*2:trunc(ih/2)*2\" $output";
exec($cmd);
$attachment['name'] = $output;
.
.
.
function upload_file($file, $path, $filename="")
{
.
.
//$moved = @move_uploaded_file($file['tmp_name'], $path."/".$filename);
.
.
}
ffmpeg works.
make 7M gif file to 300KB mp4 file.
*I am using imgur, but I want to upload file directly to my server.