From 56d981c8ef0680d5124214b4cd8849b9a42feeb7 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 20 Nov 2017 14:48:29 -0800 Subject: provide a generalised interface for thumbnail generators to support various content types --- Zotlabs/Thumbs/Text.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Zotlabs/Thumbs/Text.php (limited to 'Zotlabs/Thumbs') diff --git a/Zotlabs/Thumbs/Text.php b/Zotlabs/Thumbs/Text.php new file mode 100644 index 000000000..86d788992 --- /dev/null +++ b/Zotlabs/Thumbs/Text.php @@ -0,0 +1,49 @@ + $t) { + $l = $l + 1; + $x = 3; + $y = ($l * $lsize) + 3 - $fsize; + imagestring($image,1,$x,$y,$t,$colour); + if(($l * $lsize) >= $height) { + break; + } + } + imagejpeg($image,dbunescbin($attach['content']) . '.thumb'); + } + } +} \ No newline at end of file -- cgit v1.2.3 From 7f9ab491f29a71387bbbb066b9f6cea083d8813c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 20 Nov 2017 15:44:25 -0800 Subject: add mp3 audio thumbnail generator --- Zotlabs/Thumbs/Mp3audio.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Zotlabs/Thumbs/Mp3audio.php (limited to 'Zotlabs/Thumbs') diff --git a/Zotlabs/Thumbs/Mp3audio.php b/Zotlabs/Thumbs/Mp3audio.php new file mode 100644 index 000000000..d2e660cf8 --- /dev/null +++ b/Zotlabs/Thumbs/Mp3audio.php @@ -0,0 +1,37 @@ +analyze(dbunescbin($attach['content'])); + + $photo = isset($id['id3v2']['APIC'][0]['data']) ? $id['id3v2']['APIC'][0]['data'] : null; + if(is_null($photo) && isset($id['id3v2']['PIC'][0]['data'])) { + $photo = $id['id3v2']['PIC'][0]['data']; + } + + if($photo) { + $image = imagecreatefromstring($photo); + $dest = imagecreatetruecolor( $width, $height ); + $srcwidth = imagesx($image); + $srcheight = imagesy($image); + + imagealphablending($dest, false); + imagesavealpha($dest, true); + imagecopyresampled($dest, $image, 0, 0, 0, 0, $width, $height, $srcwidth, $srcheight); + imagedestroy($image); + imagejpeg($dest,dbunescbin($attach['content']) . '.thumb'); + } + } +} + -- cgit v1.2.3 From 1810edae93565d5340e724b4411520ea18e2b7e0 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 20 Nov 2017 16:05:24 -0800 Subject: more work theming the tile view --- Zotlabs/Thumbs/Text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Thumbs') diff --git a/Zotlabs/Thumbs/Text.php b/Zotlabs/Thumbs/Text.php index 86d788992..3ee7819bd 100644 --- a/Zotlabs/Thumbs/Text.php +++ b/Zotlabs/Thumbs/Text.php @@ -23,7 +23,7 @@ class Text { $image = imagecreate($width,$height); imagecolorallocate($image,255,255,255); $colour = imagecolorallocate($image,0,0,0); - $border = imagecolorallocate($image,64,64,64); + $border = imagecolorallocate($image,208,208,208); $x1 = 0; $y1 = 0; -- cgit v1.2.3 From 53445ba6bdd1cde780f4a3d84cbb061cb6b72df9 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 20 Nov 2017 18:14:44 -0800 Subject: fix album cover thumb generator --- Zotlabs/Thumbs/Mp3audio.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Thumbs') diff --git a/Zotlabs/Thumbs/Mp3audio.php b/Zotlabs/Thumbs/Mp3audio.php index d2e660cf8..000d65b22 100644 --- a/Zotlabs/Thumbs/Mp3audio.php +++ b/Zotlabs/Thumbs/Mp3audio.php @@ -2,7 +2,7 @@ namespace Zotlabs\Thumbs; -use ID3Parser\ID3Parser; +use \ID3Parser\ID3Parser; class Mp3audio { @@ -11,7 +11,7 @@ class Mp3audio { } function Thumb($attach,$preview_style,$height = 300, $width = 300) { - $p = newID3Parser(); + $p = new ID3Parser(); $id = $p->analyze(dbunescbin($attach['content'])); -- cgit v1.2.3