photos now work across status.net installs. needs to be cleaned up though.

This commit is contained in:
Ian Denhardt 2010-08-11 12:39:10 -04:00
parent c6c08d8969
commit 769d6089de
2 changed files with 8 additions and 6 deletions

View File

@ -48,12 +48,12 @@ class GNUsocialPhotosPlugin extends Plugin
case 'PhotouploadAction': case 'PhotouploadAction':
include_once $dir . '/lib/photolib.php'; include_once $dir . '/lib/photolib.php';
include_once $dir . '/actions/' . strtolower(mb_substr($cls, 0, -6)) . '.php'; include_once $dir . '/actions/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
include_once $dir . '/classes/gnusocialphoto.php';
break; break;
default: default:
break; break;
} }
include_once $dir . '/classes/gnusocialphoto.php';
return true; return true;
} }
@ -75,14 +75,14 @@ class GNUsocialPhotosPlugin extends Plugin
return true; return true;
} }
/* function onStartActivityDefaultObjectType(&$notice, &$xs, &$type) function onStartActivityDefaultObjectType(&$notice, &$xs, &$type)
{ {
$photo = GNUsocialPhoto::staticGet('notice_id', $notice->id); $photo = GNUsocialPhoto::staticGet('notice_id', $notice->id);
if($photo) { if($photo) {
$type = ActivityObject::PHOTO; $type = ActivityObject::PHOTO;
} }
} */ }
/*
function onStartShowNoticeItem($action) function onStartShowNoticeItem($action)
{ {
$photo = GNUsocialPhoto::staticGet('notice_id', $action->notice->id); $photo = GNUsocialPhoto::staticGet('notice_id', $action->notice->id);
@ -98,5 +98,5 @@ class GNUsocialPhotosPlugin extends Plugin
return false; return false;
} }
return true; return true;
} } */
} }

View File

@ -86,7 +86,9 @@ class GNUsocialPhoto extends Memcached_DataObject
$photo->path = $path; $photo->path = $path;
$photo->owner_id = $profile_id; $photo->owner_id = $profile_id;
$notice = Notice::saveNew($profile_id, 'http://' . common_config('site', 'server') . $path, $source); $rend = sprintf('<a href="http://%s%s"><img src="http://%s%s" /></a>', common_config('site', 'server'), $path, common_config('site', 'server'), $thumb_path);
$notice = Notice::saveNew($profile_id, 'http://' . common_config('site', 'server') . $path, $source, array('rendered' => $rend));
$photo->notice_id = $notice->id; $photo->notice_id = $notice->id;
$photo_id = $photo->insert(); $photo_id = $photo->insert();
if (!$photo_id) { if (!$photo_id) {