From 620be743083e3c7c53d71c7686175c8ad341c7cb Mon Sep 17 00:00:00 2001 From: Greg Froese Date: Fri, 22 May 2009 15:43:19 +0000 Subject: added river activity for uploaded images --- actions/upload.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'actions/upload.php') diff --git a/actions/upload.php b/actions/upload.php index 6e21fd7b0..6a941fa66 100644 --- a/actions/upload.php +++ b/actions/upload.php @@ -47,6 +47,9 @@ $uploaded_images = array(); $not_uploaded = array(); $error_msgs = array(); + + $river_view = get_plugin_setting('river_view', 'tidypics'); + foreach($_FILES as $key => $sent_file) { // skip empty entries @@ -155,18 +158,24 @@ tp_watermark($thumbs); + //keep one file handy so we can add a notice to the river + if(!$file_for_river) { + $file_for_river = $file; + } + } // end of image library selector //get and store the exif data td_get_exif($file); array_push($uploaded_images, $file->guid); + if($river_view == "all") { + add_to_river('river/object/image/create', 'create', $file->getObjectOwnerGUID(), $file->getGUID()); + } unset($file); // may not be needed but there seems to be a memory leak - } //end of for loop - - + if (count($not_uploaded) > 0) { if (count($uploaded_images) > 0) $error = sprintf(elgg_echo("tidypics:partialuploadfailure"), count($not_uploaded), count($not_uploaded) + count($uploaded_images)) . '
'; @@ -195,6 +204,13 @@ add_to_river('river/object/album/create', 'create', $album->owner_guid, $album->guid); $album->new_album = TP_OLD_ALBUM; } + + if(count($uploaded_images) && $river_view == "1") { + if (function_exists('add_to_river')) { + add_to_river('river/object/image/create', 'create', $file_for_river->getObjectOwnerGUID(), $file_for_river->getGUID()); + } + } + // plugins can register to be told when a Tidypics album has had images added trigger_elgg_event('upload', 'tp_album', $album); -- cgit v1.2.3