mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 00:52:33 -04:00
hotfix: make sure to not pass an empty path to fopen()
This commit is contained in:
@@ -30,9 +30,14 @@ class Epubthumb {
|
||||
*/
|
||||
function Thumb($attach, $preview_style, $height = 300, $width = 300) {
|
||||
|
||||
$file = dbunescbin($attach['content']);
|
||||
if (!$file) {
|
||||
return;
|
||||
}
|
||||
|
||||
$photo = false;
|
||||
|
||||
$ep = new \EPub(dbunescbin($attach['content']));
|
||||
$ep = new \EPub($file);
|
||||
$data = $ep->Cover();
|
||||
|
||||
if($data['found']) {
|
||||
|
||||
@@ -11,9 +11,16 @@ class Mp3audio {
|
||||
}
|
||||
|
||||
function Thumb($attach,$preview_style,$height = 300, $width = 300) {
|
||||
|
||||
$file = dbunescbin($attach['content']);
|
||||
if (!$file) {
|
||||
return;
|
||||
}
|
||||
|
||||
$photo = false;
|
||||
$p = new ID3Parser();
|
||||
|
||||
$id = $p->analyze(dbunescbin($attach['content']));
|
||||
$id = $p->analyze($file);
|
||||
|
||||
$photo = isset($id['id3v2']['APIC'][0]['data']) ? $id['id3v2']['APIC'][0]['data'] : null;
|
||||
if(is_null($photo) && isset($id['id3v2']['PIC'][0]['data'])) {
|
||||
|
||||
@@ -11,9 +11,13 @@ class Pdf {
|
||||
|
||||
function Thumb($attach,$preview_style,$height = 300, $width = 300) {
|
||||
|
||||
$file = dbunescbin($attach['content']);
|
||||
if (!$file) {
|
||||
return;
|
||||
}
|
||||
|
||||
$photo = false;
|
||||
|
||||
$file = dbunescbin($attach['content']);
|
||||
$tmpfile = $file . '.pdf';
|
||||
$outfile = $file . '.jpg';
|
||||
|
||||
|
||||
@@ -11,11 +11,12 @@ class Text {
|
||||
|
||||
function Thumb($attach,$preview_style,$height = 300, $width = 300) {
|
||||
|
||||
if (empty($attach['content'])) {
|
||||
$file = dbunescbin($attach['content']);
|
||||
if (!$file) {
|
||||
return;
|
||||
}
|
||||
|
||||
$stream = @fopen(dbunescbin($attach['content']),'rb');
|
||||
$stream = @fopen($file,'rb');
|
||||
if($stream) {
|
||||
$content = trim(stream_get_contents($stream,4096));
|
||||
$content = str_replace("\r",'',$content);
|
||||
|
||||
@@ -11,16 +11,19 @@ class Video {
|
||||
|
||||
function Thumb($attach,$preview_style,$height = 300, $width = 300) {
|
||||
|
||||
$file = dbunescbin($attach['content']);
|
||||
if (!$file) {
|
||||
return;
|
||||
}
|
||||
|
||||
$photo = false;
|
||||
|
||||
$t = explode('/',$attach['filetype']);
|
||||
if($t[1])
|
||||
$extension = '.' . $t[1];
|
||||
else
|
||||
return;
|
||||
return;
|
||||
|
||||
|
||||
$file = dbunescbin($attach['content']);
|
||||
$tmpfile = $file . $extension;
|
||||
$outfile = $file . '.jpg';
|
||||
|
||||
@@ -40,7 +43,7 @@ class Video {
|
||||
|
||||
|
||||
$ffmpeg = trim(shell_exec('which ffmpeg'));
|
||||
if($ffmpeg) {
|
||||
if($ffmpeg) {
|
||||
logger('ffmpeg not found in path. Video thumbnails may fail.');
|
||||
}
|
||||
|
||||
@@ -59,7 +62,7 @@ class Video {
|
||||
@rename($outfile,$file . '.thumb');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@unlink($tmpfile);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user