mirror of
https://github.com/HaschekSolutions/pictshare.git
synced 2025-11-15 20:48:00 +00:00
added mp4 preview image generation
This commit is contained in:
@@ -20,10 +20,10 @@ PictShare is a selfhostable, open source image, video and text hosting as well a
|
|||||||
- [x] Write permission detection
|
- [x] Write permission detection
|
||||||
|
|
||||||
### Image hosting
|
### Image hosting
|
||||||
- [x] Upload of images
|
|
||||||
- [ ] Resizing
|
- [ ] Resizing
|
||||||
- [ ] Filters
|
- [ ] Filters
|
||||||
- [ ] Gif to mp4 conversion
|
- [ ] Gif to mp4 conversion
|
||||||
|
- [x] Upload of images
|
||||||
|
|
||||||
### Text file hosting
|
### Text file hosting
|
||||||
- [x] Upload of text files
|
- [x] Upload of text files
|
||||||
@@ -36,6 +36,7 @@ PictShare is a selfhostable, open source image, video and text hosting as well a
|
|||||||
|
|
||||||
### MP4 hosting
|
### MP4 hosting
|
||||||
- [ ] Resizing
|
- [ ] Resizing
|
||||||
|
- [x] Preview image generation
|
||||||
- [x] Upload of videos
|
- [x] Upload of videos
|
||||||
- [x] Automatic conversion if not mobile friendly or wrong encoder used
|
- [x] Automatic conversion if not mobile friendly or wrong encoder used
|
||||||
- [x] Render template for videos
|
- [x] Render template for videos
|
||||||
@@ -14,6 +14,18 @@ class VideoController
|
|||||||
|
|
||||||
if(in_array('raw',$url))
|
if(in_array('raw',$url))
|
||||||
$this->serveMP4($path,$hash);
|
$this->serveMP4($path,$hash);
|
||||||
|
else if(in_array('preview',$url))
|
||||||
|
{
|
||||||
|
$preview = ROOT.DS.'data'.DS.$hash.DS.'preview.jpg';
|
||||||
|
if(!file_exists($preview))
|
||||||
|
{
|
||||||
|
$this->saveFirstFrameOfMP4($path,$preview);
|
||||||
|
}
|
||||||
|
|
||||||
|
header ("Content-type: image/jpeg");
|
||||||
|
readfile($preview);
|
||||||
|
|
||||||
|
}
|
||||||
else if(in_array('download',$url))
|
else if(in_array('download',$url))
|
||||||
{
|
{
|
||||||
if (file_exists($path)) {
|
if (file_exists($path)) {
|
||||||
@@ -174,4 +186,13 @@ class VideoController
|
|||||||
unlink(ROOT.DS.'tmp'.DS.$hash.'.txt');
|
unlink(ROOT.DS.'tmp'.DS.$hash.'.txt');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function saveFirstFrameOfMP4($path,$target)
|
||||||
|
{
|
||||||
|
$bin = escapeshellcmd(FFMPEG_BINARY);
|
||||||
|
$file = escapeshellarg($path);
|
||||||
|
$cmd = "$bin -y -i $file -vframes 1 -f image2 $target";
|
||||||
|
|
||||||
|
system($cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user