diff options
Diffstat (limited to 'Zotlabs/Thumbs')
-rw-r--r-- | Zotlabs/Thumbs/Epubthumb.php | 7 | ||||
-rw-r--r-- | Zotlabs/Thumbs/Mp3audio.php | 9 | ||||
-rw-r--r-- | Zotlabs/Thumbs/Pdf.php | 6 | ||||
-rw-r--r-- | Zotlabs/Thumbs/Text.php | 5 | ||||
-rw-r--r-- | Zotlabs/Thumbs/Video.php | 13 |
5 files changed, 30 insertions, 10 deletions
diff --git a/Zotlabs/Thumbs/Epubthumb.php b/Zotlabs/Thumbs/Epubthumb.php index 22f1a5e8f..6ebbd8933 100644 --- a/Zotlabs/Thumbs/Epubthumb.php +++ b/Zotlabs/Thumbs/Epubthumb.php @@ -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']) { diff --git a/Zotlabs/Thumbs/Mp3audio.php b/Zotlabs/Thumbs/Mp3audio.php index 000d65b22..c50338fb2 100644 --- a/Zotlabs/Thumbs/Mp3audio.php +++ b/Zotlabs/Thumbs/Mp3audio.php @@ -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'])) { diff --git a/Zotlabs/Thumbs/Pdf.php b/Zotlabs/Thumbs/Pdf.php index 11714ad53..6f9111ed3 100644 --- a/Zotlabs/Thumbs/Pdf.php +++ b/Zotlabs/Thumbs/Pdf.php @@ -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'; diff --git a/Zotlabs/Thumbs/Text.php b/Zotlabs/Thumbs/Text.php index 31e27d014..b2f13c578 100644 --- a/Zotlabs/Thumbs/Text.php +++ b/Zotlabs/Thumbs/Text.php @@ -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); diff --git a/Zotlabs/Thumbs/Video.php b/Zotlabs/Thumbs/Video.php index 15d3ace12..9df27d703 100644 --- a/Zotlabs/Thumbs/Video.php +++ b/Zotlabs/Thumbs/Video.php @@ -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); } } |