add svg backend
This commit is contained in:
parent
dd06387a9c
commit
13c6ef1ba9
|
@ -15,6 +15,7 @@ require_once('preview/images.php');
|
|||
require_once('preview/movies.php');
|
||||
require_once('preview/mp3.php');
|
||||
require_once('preview/pdf.php');
|
||||
require_once('preview/svg.php');
|
||||
require_once('preview/unknown.php');
|
||||
|
||||
class OC_Preview {
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
class OC_Preview_SVG extends OC_Preview_Provider{
|
||||
|
||||
public function getMimeType(){
|
||||
return '/image\/svg\+xml/';
|
||||
}
|
||||
|
||||
public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) {
|
||||
$svg = new Imagick();
|
||||
$svg->readImageBlob($fileview->file_get_contents($path));
|
||||
$svg->setImageFormat('jpg');
|
||||
|
||||
//new image object
|
||||
$image = new \OC_Image($svg);
|
||||
//check if image object is valid
|
||||
if (!$image->valid()) return false;
|
||||
|
||||
return $image;
|
||||
}
|
||||
}
|
||||
|
||||
OC_Preview::registerProvider('OC_Preview_SVG');
|
Loading…
Reference in New Issue