aboutsummaryrefslogtreecommitdiff
path: root/actions/ajax_upload.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2010-10-24 21:08:27 +0000
committerCash Costello <cash.costello@gmail.com>2010-10-24 21:08:27 +0000
commitda1493b95a2f0b5000a487ae373c9318c58d0b2d (patch)
treea339b053ade9fb15a1717bdf248a59afc9b3d239 /actions/ajax_upload.php
parent5161b1c8fdc8ff69005f864a89127fc18db6d4ed (diff)
downloadelgg-da1493b95a2f0b5000a487ae373c9318c58d0b2d.tar.gz
elgg-da1493b95a2f0b5000a487ae373c9318c58d0b2d.tar.bz2
partial implementation of flash uploader
Diffstat (limited to 'actions/ajax_upload.php')
-rw-r--r--actions/ajax_upload.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/actions/ajax_upload.php b/actions/ajax_upload.php
new file mode 100644
index 000000000..3d44df199
--- /dev/null
+++ b/actions/ajax_upload.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Elgg single upload action for flash/ajax uploaders
+ *
+ */
+
+include_once dirname(dirname(__FILE__)) . "/lib/upload.php";
+
+$album_guid = (int) get_input('album_guid');
+$file_var_name = get_input('file_var_name', 'Image');
+
+$album = get_entity($album_guid);
+if (!$album) {
+ exit;
+}
+
+if (empty($_FILES)) {
+ exit;
+}
+
+$image_lib = get_plugin_setting('image_lib', 'tidypics');
+if (!$image_lib) {
+ $image_lib = "GD";
+}
+
+$temp_file = $_FILES['Image']['tmp_name'];
+$name = $_FILES['Image']['name'];
+$file_size = $_FILES['Image']['size'];
+
+$image = new TidypicsImage();
+$image->container_guid = $album_guid;
+$image->setMimeType(tp_upload_get_mimetype($name));
+$image->simpletype = "image";
+$image->access_id = $album->access_id;
+$image->title = substr($name, 0, strrpos($name, '.'));
+$image_guid = $image->save();
+
+$image->setOriginalFilename($name);
+$image->saveImageFile($temp_file, $file_size);
+
+$image->extractExifData();
+$image->saveThumbnails($image_lib);
+
+$album->prependImageList(array($image->guid));
+
+echo "1";
+exit; \ No newline at end of file