summaryrefslogtreecommitdiffstats
path: root/application/libraries/Image.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-05-02 17:00:17 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-05-02 17:00:17 +0200
commit2b090dbe79a52520459c7c375b050501293b578f (patch)
tree148e80b9f611d5df995759776ef2bcc8e7de5037 /application/libraries/Image.php
parent70567d2c1eba3ae3182de82f2fdeea5fc44253a6 (diff)
Get supported image types from drivers
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/libraries/Image.php')
-rw-r--r--application/libraries/Image.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/application/libraries/Image.php b/application/libraries/Image.php
index deefc760d..c6cd20d06 100644
--- a/application/libraries/Image.php
+++ b/application/libraries/Image.php
@@ -124,6 +124,25 @@ class Image {
}
/**
+ * Check if a mimetype is supported by the image library.
+ *
+ * @param mimetype
+ * @return true if supported, false otherwise
+ */
+ public static function type_supported($mimetype)
+ {
+ try {
+ $driver = self::best_driver(self::get_image_drivers(), $mimetype);
+ } catch (\exceptions\ApiException $e) {
+ if ($e->get_error_id() == "libraries/Image/unsupported-image-type") {
+ return false;
+ }
+ throw $e;
+ }
+ return true;
+ }
+
+ /**
* Replace the current image by reading in a file
* @param file file to read
*/