container_guid = $album->getGUID(); $image->setMimeType($mime); $image->access_id = $album->access_id; $image->batch = $batch; try { $image->save($file); $album->prependImageList(array($image->guid)); if (elgg_get_plugin_setting('img_river_view', 'tidypics') === "all") { add_to_river('river/object/image/create', 'create', $image->getObjectOwnerGUID(), $image->getGUID()); } echo elgg_echo('success'); } catch (Exception $e) { // remove the bits that were saved $image->delete(); echo $e->getMessage(); } exit;