summaryrefslogtreecommitdiffstats
path: root/application/libraries/Exif.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-03-02 12:14:58 +0100
committerFlorian Pritz <bluewind@xinu.at>2015-03-02 12:14:58 +0100
commite9e9e635b337dc46111cdf95ccb16b7d28deb849 (patch)
treec69c6e12c48f71306cf54640b24b8c133f793090 /application/libraries/Exif.php
parentea8471781ee26f79c3835e68b31353601e78d0a8 (diff)
Add imagemagick support
Adds additional support for imagemagick if GD doesn't support a file type and extends the files displayed as thumbnails to all images and pdf files. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/libraries/Exif.php')
-rw-r--r--application/libraries/Exif.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/application/libraries/Exif.php b/application/libraries/Exif.php
new file mode 100644
index 000000000..27dd11a65
--- /dev/null
+++ b/application/libraries/Exif.php
@@ -0,0 +1,37 @@
+<?php
+/*
+ * Copyright 2014-2015 Florian "Bluewind" Pritz <bluewind@server-speed.net>
+ *
+ * Licensed under AGPLv3
+ * (see COPYING for full license text)
+ *
+ */
+
+namespace libraries;
+
+class Exif {
+ static public function get_exif($file)
+ {
+ // TODO: support more types (identify or exiftool? might be slow :( )
+ try {
+ $type = getimagesize($file)[2];
+ } catch (\ErrorException $e) {
+ return false;
+ }
+ switch ($type) {
+ case IMAGETYPE_JPEG:
+ getimagesize($file, $info);
+ if (isset($info["APP1"]) && strpos($info["APP1"], "http://ns.adobe.com/xap/1.0/") === 0) {
+ // ignore XMP data which makes exif_read_data throw a warning
+ // http://stackoverflow.com/a/8864064
+ return false;
+ }
+ return @exif_read_data($file);
+ break;
+ default:
+ }
+
+ return false;
+ }
+
+}