Skip to content

Commit

Permalink
Raw support will be in 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
oparoz committed Jun 1, 2015
1 parent 63a136b commit bb3ae67
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 195 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,14 @@ Next add a few new entries to your **config/config.php** configuration file.
'preview_max_scale_factor' => 1,
'enabledPreviewProviders' =>
array (
0 => 'OC\\Preview\\Image',
1 => 'OC\\Preview\\Illustrator',
2 => 'OC\\Preview\\Postscript',
3 => 'OC\\Preview\\Photoshop',
4 => 'OC\\Preview\\TIFF',
0 => 'OC\\Preview\\PNG',
1 => 'OC\\Preview\\JPEG',
2 => 'OC\\Preview\\GIF',
11 => 'OC\\Preview\\Illustrator',
12 => 'OC\\Preview\\Postscript',
13 => 'OC\\Preview\\Photoshop',
14 => 'OC\\Preview\\TIFF',
15 => 'OC\\Preview\\Raw'
),
```

Expand Down Expand Up @@ -172,4 +175,4 @@ $ git pull --rebase origin dev
```

## List of patches
None so far
None so far
189 changes: 0 additions & 189 deletions patches/raw-preview.pull.13652.patch
Original file line number Diff line number Diff line change
@@ -1,189 +0,0 @@
From 95f0efccba6588e361df5207a3ead7706e3ddc2d Mon Sep 17 00:00:00 2001
From: Olivier Paroz <[email protected]>
Date: Sat, 24 Jan 2015 23:50:48 +0100
Subject: [PATCH] Add support for Raw files previews

---
lib/private/helper.php | 1 +
lib/private/mimetypes.list.php | 17 +++++++++++++++++
lib/private/preview.php | 3 ++-
lib/private/preview/image.php | 2 +-
lib/private/preview/raw.php | 19 +++++++++++++++++++
6 files changed, 41 insertions(+), 2 deletions(-)
create mode 100644 lib/private/preview/raw.php

diff --git a/lib/private/helper.php b/lib/private/helper.php
index 6268bd3..ce38e90 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -39,6 +39,7 @@ class OC_Helper {
'application/coreldraw' => 'image',
'application/x-gimp' => 'image',
'application/x-photoshop' => 'image',
+ 'application/x-dcraw' => 'image',

'application/x-font-ttf' => 'font',
'application/font-woff' => 'font',
diff --git a/lib/private/mimetypes.list.php b/lib/private/mimetypes.list.php
index 4f11829..a08660d 100644
--- a/lib/private/mimetypes.list.php
+++ b/lib/private/mimetypes.list.php
@@ -33,6 +33,7 @@
'accdb' => array('application/msaccess', null),
'ai' => array('application/illustrator', null),
'apk' => array('application/vnd.android.package-archive', null),
+ 'arw' => array('image/x-dcraw', null),
'avi' => array('video/x-msvideo', null),
'bash' => array('text/x-shellscript', null),
'blend' => array('application/x-blender', null),
@@ -47,12 +48,15 @@
'cc' => array('text/x-c', null),
'cdr' => array('application/coreldraw', null),
'cpp' => array('text/x-c++src', null),
+ 'cr2' => array('image/x-dcraw', null),
'css' => array('text/css', null),
'csv' => array('text/csv', null),
'cvbdl' => array('application/x-cbr', null),
'c' => array('text/x-c', null),
'c++' => array('text/x-c++src', null),
+ 'dcr' => array('image/x-dcraw', null),
'deb' => array('application/x-deb', null),
+ 'dng' => array('image/x-dcraw', null),
'doc' => array('application/msword', null),
'docm' => array('application/vnd.ms-word.document.macroEnabled.12', null),
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', null),
@@ -62,6 +66,7 @@
'eot' => array('application/vnd.ms-fontobject', null),
'epub' => array('application/epub+zip', null),
'eps' => array('application/postscript', null),
+ 'erf' => array('image/x-dcraw', null),
'exe' => array('application/x-ms-dos-executable', null),
'flac' => array('audio/flac', null),
'flv' => array('video/x-flv', null),
@@ -72,11 +77,14 @@
'htm' => array('text/html', 'text/plain'),
'ical' => array('text/calendar', null),
'ics' => array('text/calendar', null),
+ 'iiq' => array('image/x-dcraw', null),
'impress' => array('text/impress', null),
'jpeg' => array('image/jpeg', null),
'jpg' => array('image/jpeg', null),
'js' => array('application/javascript', 'text/plain'),
'json' => array('application/json', 'text/plain'),
+ 'k25' => array('image/x-dcraw', null),
+ 'kdc' => array('image/x-dcraw', null),
'key' => array('application/x-iwork-keynote-sffkey', null),
'keynote' => array('application/x-iwork-keynote-sffkey', null),
'kra' => array('application/x-krita', null),
@@ -87,6 +95,7 @@
'md' => array('text/markdown', null),
'mdb' => array('application/msaccess', null),
'mdwn' => array('text/markdown', null),
+ 'mef' => array('image/x-dcraw', null),
'mkv' => array('video/x-matroska', null),
'mobi' => array('application/x-mobipocket-ebook', null),
'mov' => array('video/quicktime', null),
@@ -95,6 +104,7 @@
'mpeg' => array('video/mpeg', null),
'mpg' => array('video/mpeg', null),
'msi' => array('application/x-msi', null),
+ 'nef' => array('image/x-dcraw', null),
'numbers' => array('application/x-iwork-numbers-sffnumbers', null),
'odf' => array('application/vnd.oasis.opendocument.formula', null),
'odg' => array('application/vnd.oasis.opendocument.graphics', null),
@@ -104,9 +114,11 @@
'oga' => array('audio/ogg', null),
'ogg' => array('audio/ogg', null),
'ogv' => array('video/ogg', null),
+ 'orf' => array('image/x-dcraw', null),
'otf' => array('font/opentype', null),
'pages' => array('application/x-iwork-pages-sffpages', null),
'pdf' => array('application/pdf', null),
+ 'pef' => array('image/x-dcraw', null),
'php' => array('application/x-php', null),
'pl' => array('application/x-perl', null),
'png' => array('image/png', null),
@@ -124,11 +136,15 @@
'ps' => array('application/postscript', null),
'psd' => array('application/x-photoshop', null),
'py' => array('text/x-python', null),
+ 'raf' => array('image/x-dcraw', null),
'rar' => array('application/x-rar-compressed', null),
'reveal' => array('text/reveal', null),
+ 'rw2' => array('image/x-dcraw', null),
'sgf' => array('application/sgf', null),
'sh-lib' => array('text/x-shellscript', null),
'sh' => array('text/x-shellscript', null),
+ 'srf' => array('image/x-dcraw', null),
+ 'sr2' => array('image/x-dcraw', null),
'svg' => array('image/svg+xml', 'text/plain'),
'swf' => array('application/x-shockwave-flash', 'application/octet-stream'),
'tar' => array('application/x-tar', null),
@@ -157,5 +173,6 @@
'xltm' => array('application/vnd.ms-excel.template.macroEnabled.12', null),
'xltx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.template', null),
'xml' => array('application/xml', 'text/plain'),
+ 'xrf' => array('image/x-dcraw', null),
'zip' => array('application/zip', null),
);
diff --git a/lib/private/preview.php b/lib/private/preview.php
index c7ef006..0177418 100644
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -712,6 +712,7 @@ public static function registerProvider($class, $options = array()) {
* - OC\Preview\Illustrator
* - OC\Preview\Postscript
* - OC\Preview\Photoshop
+ * - OC\Preview\Raw
*/
if(empty(self::$enabledProviders)) {
self::$enabledProviders = \OC::$server->getConfig()->getSystemValue('enabledPreviewProviders', array(
@@ -771,8 +772,8 @@ protected static function registerCoreProviders() {
'PDF' => 'OC\Preview\PDF',
'AI' => 'OC\Preview\Illustrator',
'PSD' => 'OC\Preview\Photoshop',
- // Requires adding 'eps' => array('application/postscript', null), to lib/private/mimetypes.list.php
'EPS' => 'OC\Preview\Postscript',
+ 'CR2' => 'OC\Preview\Raw',
);

foreach ($imagickProviders as $queryFormat => $provider) {
diff --git a/lib/private/preview/image.php b/lib/private/preview/image.php
index e8473eb..fbca47862 100644
--- a/lib/private/preview/image.php
+++ b/lib/private/preview/image.php
@@ -13,7 +13,7 @@ class Image extends Provider {
* {@inheritDoc}
*/
public function getMimeType() {
- return '/image\/(?!tiff$)(?!svg.*).*/';
+ return '/image\/(?!x-dcraw$)(?!tiff$)(?!svg.*).*/';
}

/**
diff --git a/lib/private/preview/raw.php b/lib/private/preview/raw.php
new file mode 100644
index 0000000..22b2ae4
--- /dev/null
+++ b/lib/private/preview/raw.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * @copyright Olivier Paroz 2015 <[email protected]>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Preview;
+
+// Supports many file extensions linked to RAW
+class Raw extends Bitmap {
+ /**
+ * {@inheritDoc}
+ */
+ public function getMimeType() {
+ return '/image\/x-dcraw/';
+ }
+}
\ No newline at end of file

0 comments on commit bb3ae67

Please sign in to comment.