* | * | ||||
* The following providers are enabled by default: | * The following providers are enabled by default: | ||||
* | * | ||||
* - OC\Preview\Image | |||||
* - OC\Preview\PNG | |||||
* - OC\Preview\JPEG | |||||
* - OC\Preview\GIF | |||||
* - OC\Preview\BMP | |||||
* - OC\Preview\XBitmap | |||||
* - OC\Preview\MarkDown | * - OC\Preview\MarkDown | ||||
* - OC\Preview\MP3 | * - OC\Preview\MP3 | ||||
* - OC\Preview\TXT | * - OC\Preview\TXT | ||||
* - OC\Preview\StarOffice | * - OC\Preview\StarOffice | ||||
*/ | */ | ||||
'enabledPreviewProviders' => array( | 'enabledPreviewProviders' => array( | ||||
'OC\Preview\Image', | |||||
'OC\Preview\PNG', | |||||
'OC\Preview\JPEG', | |||||
'OC\Preview\GIF', | |||||
'OC\Preview\BMP', | |||||
'OC\Preview\XBitmap', | |||||
'OC\Preview\MP3', | 'OC\Preview\MP3', | ||||
'OC\Preview\TXT', | 'OC\Preview\TXT', | ||||
'OC\Preview\MarkDown' | 'OC\Preview\MarkDown' |
<?php | |||||
/** | |||||
* @author Olivier Paroz <owncloud@interfasys.ch> | |||||
* | |||||
* @copyright Copyright (c) 2015, ownCloud, Inc. | |||||
* @license AGPL-3.0 | |||||
* | |||||
* This code is free software: you can redistribute it and/or modify | |||||
* it under the terms of the GNU Affero General Public License, version 3, | |||||
* as published by the Free Software Foundation. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU Affero General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
* | |||||
*/ | |||||
namespace OC\Preview; | |||||
class BMP extends Image { | |||||
/** | |||||
* {@inheritDoc} | |||||
*/ | |||||
public function getMimeType() { | |||||
return '/image\/bmp/'; | |||||
} | |||||
} |
<?php | |||||
/** | |||||
* @author Olivier Paroz <owncloud@interfasys.ch> | |||||
* | |||||
* @copyright Copyright (c) 2015, ownCloud, Inc. | |||||
* @license AGPL-3.0 | |||||
* | |||||
* This code is free software: you can redistribute it and/or modify | |||||
* it under the terms of the GNU Affero General Public License, version 3, | |||||
* as published by the Free Software Foundation. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU Affero General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
* | |||||
*/ | |||||
namespace OC\Preview; | |||||
class GIF extends Image { | |||||
/** | |||||
* {@inheritDoc} | |||||
*/ | |||||
public function getMimeType() { | |||||
return '/image\/gif/'; | |||||
} | |||||
} |
<?php | <?php | ||||
/** | /** | ||||
* @author Georg Ehrke <georg@owncloud.com> | * @author Georg Ehrke <georg@owncloud.com> | ||||
* @author Georg Ehrke <georg@ownCloud.com> | |||||
* @author Olivier Paroz <owncloud@interfasys.ch> | |||||
* @author Joas Schilling <nickvergessen@owncloud.com> | * @author Joas Schilling <nickvergessen@owncloud.com> | ||||
* @author Morris Jobke <hey@morrisjobke.de> | * @author Morris Jobke <hey@morrisjobke.de> | ||||
* @author Thomas Müller <thomas.mueller@tmit.eu> | * @author Thomas Müller <thomas.mueller@tmit.eu> | ||||
*/ | */ | ||||
namespace OC\Preview; | namespace OC\Preview; | ||||
class Image extends Provider { | |||||
/** | |||||
* {@inheritDoc} | |||||
*/ | |||||
public function getMimeType() { | |||||
return '/image\/(?!tiff$)(?!svg.*).*/'; | |||||
} | |||||
abstract class Image extends Provider { | |||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} |
<?php | |||||
/** | |||||
* @author Olivier Paroz <owncloud@interfasys.ch> | |||||
* | |||||
* @copyright Copyright (c) 2015, ownCloud, Inc. | |||||
* @license AGPL-3.0 | |||||
* | |||||
* This code is free software: you can redistribute it and/or modify | |||||
* it under the terms of the GNU Affero General Public License, version 3, | |||||
* as published by the Free Software Foundation. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU Affero General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
* | |||||
*/ | |||||
namespace OC\Preview; | |||||
class JPEG extends Image { | |||||
/** | |||||
* {@inheritDoc} | |||||
*/ | |||||
public function getMimeType() { | |||||
return '/image\/jpeg/'; | |||||
} | |||||
} |
<?php | |||||
/** | |||||
* @author Olivier Paroz <owncloud@interfasys.ch> | |||||
* | |||||
* @copyright Copyright (c) 2015, ownCloud, Inc. | |||||
* @license AGPL-3.0 | |||||
* | |||||
* This code is free software: you can redistribute it and/or modify | |||||
* it under the terms of the GNU Affero General Public License, version 3, | |||||
* as published by the Free Software Foundation. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU Affero General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
* | |||||
*/ | |||||
namespace OC\Preview; | |||||
class PNG extends Image { | |||||
/** | |||||
* {@inheritDoc} | |||||
*/ | |||||
public function getMimeType() { | |||||
return '/image\/png/'; | |||||
} | |||||
} |
<?php | |||||
/** | |||||
* @author Olivier Paroz <owncloud@interfasys.ch> | |||||
* | |||||
* @copyright Copyright (c) 2015, ownCloud, Inc. | |||||
* @license AGPL-3.0 | |||||
* | |||||
* This code is free software: you can redistribute it and/or modify | |||||
* it under the terms of the GNU Affero General Public License, version 3, | |||||
* as published by the Free Software Foundation. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU Affero General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
* | |||||
*/ | |||||
namespace OC\Preview; | |||||
class XBitmap extends Image { | |||||
/** | |||||
* {@inheritDoc} | |||||
*/ | |||||
public function getMimeType() { | |||||
return '/image\/x-xbitmap/'; | |||||
} | |||||
} |
* List of enabled default providers | * List of enabled default providers | ||||
* | * | ||||
* The following providers are enabled by default: | * The following providers are enabled by default: | ||||
* - OC\Preview\Image | |||||
* - OC\Preview\PNG | |||||
* - OC\Preview\JPEG | |||||
* - OC\Preview\GIF | |||||
* - OC\Preview\BMP | |||||
* - OC\Preview\XBitmap | |||||
* - OC\Preview\MarkDown | * - OC\Preview\MarkDown | ||||
* - OC\Preview\MP3 | * - OC\Preview\MP3 | ||||
* - OC\Preview\TXT | * - OC\Preview\TXT | ||||
return $this->defaultProviders; | return $this->defaultProviders; | ||||
} | } | ||||
$this->defaultProviders = $this->config->getSystemValue('enabledPreviewProviders', [ | |||||
'OC\Preview\Image', | |||||
$imageProviders = [ | |||||
'OC\Preview\PNG', | |||||
'OC\Preview\JPEG', | |||||
'OC\Preview\GIF', | |||||
'OC\Preview\BMP', | |||||
'OC\Preview\XBitmap' | |||||
]; | |||||
$this->defaultProviders = $this->config->getSystemValue('enabledPreviewProviders', array_merge([ | |||||
'OC\Preview\MarkDown', | 'OC\Preview\MarkDown', | ||||
'OC\Preview\MP3', | 'OC\Preview\MP3', | ||||
'OC\Preview\TXT', | 'OC\Preview\TXT', | ||||
]); | |||||
], $imageProviders)); | |||||
if (in_array('OC\Preview\Image', $this->defaultProviders)) { | |||||
$this->defaultProviders = array_merge($this->defaultProviders, $imageProviders); | |||||
} | |||||
$this->defaultProviders = array_unique($this->defaultProviders); | |||||
return $this->defaultProviders; | return $this->defaultProviders; | ||||
} | } | ||||
$this->registerCoreProvider('OC\Preview\TXT', '/text\/plain/'); | $this->registerCoreProvider('OC\Preview\TXT', '/text\/plain/'); | ||||
$this->registerCoreProvider('OC\Preview\MarkDown', '/text\/(x-)?markdown/'); | $this->registerCoreProvider('OC\Preview\MarkDown', '/text\/(x-)?markdown/'); | ||||
$this->registerCoreProvider('OC\Preview\Image', '/image\/(?!tiff$)(?!svg.*).*/'); | |||||
$this->registerCoreProvider('OC\Preview\PNG', '/image\/png/'); | |||||
$this->registerCoreProvider('OC\Preview\JPEG', '/image\/jpeg/'); | |||||
$this->registerCoreProvider('OC\Preview\GIF', '/image\/gif/'); | |||||
$this->registerCoreProvider('OC\Preview\BMP', '/image\/bmp/'); | |||||
$this->registerCoreProvider('OC\Preview\XBitmap', '/image\/x-xbitmap/'); | |||||
$this->registerCoreProvider('OC\Preview\MP3', '/audio\/mpeg/'); | $this->registerCoreProvider('OC\Preview\MP3', '/audio\/mpeg/'); | ||||
// SVG, Office and Bitmap require imagick | // SVG, Office and Bitmap require imagick |