summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/preview.php34
-rw-r--r--lib/public/template.php19
2 files changed, 53 insertions, 0 deletions
diff --git a/lib/public/preview.php b/lib/public/preview.php
new file mode 100644
index 00000000000..e488eade4da
--- /dev/null
+++ b/lib/public/preview.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Copyright (c) 2013 Frank Karlitschek frank@owncloud.org
+ * 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.
+ */
+namespace OCP;
+
+/**
+ * This class provides functions to render and show thumbnails and previews of files
+ */
+class Preview {
+
+ /**
+ * @brief return a preview of a file
+ * @param $file The path to the file where you want a thumbnail from
+ * @param $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image
+ * @param $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
+ * @param $scaleup Scale smaller images up to the thumbnail size or not. Might look ugly
+ * @return image
+ */
+ public static function show($file,$maxX=100,$maxY=75,$scaleup=false) {
+ return(\OC_Preview::show($file,$maxX,$maxY,$scaleup));
+ }
+
+
+
+ public static function isMimeSupported($mimetype='*') {
+ return \OC\Preview::isMimeSupported($mimetype);
+ }
+
+}
diff --git a/lib/public/template.php b/lib/public/template.php
index ab1089c332d..3b1a4ed4906 100644
--- a/lib/public/template.php
+++ b/lib/public/template.php
@@ -54,6 +54,25 @@ function mimetype_icon( $mimetype ) {
return(\mimetype_icon( $mimetype ));
}
+/**
+ * @brief make preview_icon available as a simple function
+ * Returns the path to the preview of the image.
+ * @param $path path of file
+ * @returns link to the preview
+ */
+function preview_icon( $path ) {
+ return(\preview_icon( $path ));
+}
+
+/**
+ * @brief make publicpreview_icon available as a simple function
+ * Returns the path to the preview of the image.
+ * @param $path path of file
+ * @returns link to the preview
+ */
+function publicPreview_icon ( $path, $token ) {
+ return(\publicPreview_icon( $path, $token ));
+}
/**
* @brief make OC_Helper::humanFileSize available as a simple function