From c51b483f24936c8d04a54a6999412937ec21c49a Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 19 Nov 2011 23:13:26 -0500 Subject: uploading photos through the basic interface works now --- pages/photos/image/thumbnail.php | 34 ++++++++++++++++++++++ pages/photos/image/upload.php | 61 +++++++++++++++++++--------------------- 2 files changed, 63 insertions(+), 32 deletions(-) create mode 100644 pages/photos/image/thumbnail.php (limited to 'pages/photos/image') diff --git a/pages/photos/image/thumbnail.php b/pages/photos/image/thumbnail.php new file mode 100644 index 000000000..ae07f2706 --- /dev/null +++ b/pages/photos/image/thumbnail.php @@ -0,0 +1,34 @@ +getThumbnail($size); +if (!$contents) { + forward("mod/tidypics/graphics/image_error_$size"); +} + +// expires every 14 days +$expires = 14 * 60*60*24; + +// overwrite header caused by php session code so images can be cached +$mime = $image->getMimeType(); +header("Content-Type: $mime"); +header("Content-Length: " . strlen($contents)); +header("Cache-Control: public", true); +header("Pragma: public", true); +header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true); + +// Return the thumbnail and exit +echo $contents; +exit; diff --git a/pages/photos/image/upload.php b/pages/photos/image/upload.php index 6580c6f52..526972a35 100644 --- a/pages/photos/image/upload.php +++ b/pages/photos/image/upload.php @@ -1,62 +1,59 @@ canEdit()) { + // @todo // throw warning and forward to previous page - forward($_SERVER['HTTP_REFERER']); + forward(REFERER); +} + +if (!$album->canEdit()) { + // @todo have to be able to edit album to upload photos } // set page owner based on container (user or group) -set_page_owner($album->container_guid); +elgg_set_page_owner_guid($album->getContainerGUID()); +$owner = elgg_get_page_owner_entity(); -$page_owner = page_owner_entity(); -if ($page_owner instanceof ElggGroup) { - add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name), - $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username); -} +$title = elgg_echo('album:addpix'); -set_context('photos'); -$title = elgg_echo('album:addpix') . ': ' . $album->title; -$area2 .= elgg_view_title($title); +// set up breadcrumbs +elgg_push_breadcrumb(elgg_echo('photos'), "photos/all"); +elgg_push_breadcrumb($owner->name, "photos/owner/$owner->username"); +elgg_push_breadcrumb($album->getTitle(), $album->getURL()); +elgg_push_breadcrumb(elgg_echo('album:addpix')); -if ($uploader == 'basic') { - $area2 .= elgg_view('input/form', array( - 'action' => "{$CONFIG->wwwroot}action/tidypics/upload", - 'body' => elgg_view('forms/tidypics/basic_upload', array('album' => $album)), - 'internalid' => 'tidypicsUpload', - 'enctype' => 'multipart/form-data', - 'method' => 'post', - )); +if ($uploader == 'basic') { + $content = elgg_view('forms/photos/basic_upload', array('entity' => $album)); } else { - $area2 .= elgg_view("forms/tidypics/ajax_upload", array('album' => $album)); + $content = elgg_view('forms/photos/ajax_upload', array('entity' => $album)); } -$body = elgg_view_layout('two_column_left_sidebar', '', $area2); +$body = elgg_view_layout('content', array( + 'content' => $content, + 'title' => $title, + 'filter' => '', +)); -page_draw($title, $body); +echo elgg_view_page($title, $body); -- cgit v1.2.3