summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Denhardt <ian@zenhack.net>2010-09-04 17:48:12 -0400
committerIan Denhardt <ian@zenhack.net>2010-09-04 17:48:12 -0400
commit70c1a9a506a6c6905fe25ffd7decfdfa5775f327 (patch)
treed8a0455892a2db691a08e7a25b278152b505d88e
parent7e8ff72c0b9c2cd1c73537edc886e6b6208a50fb (diff)
Photo Galleries now actually use the database.
-rw-r--r--plugins/GNUsocialPhotos/actions/photos.php28
1 files changed, 8 insertions, 20 deletions
diff --git a/plugins/GNUsocialPhotos/actions/photos.php b/plugins/GNUsocialPhotos/actions/photos.php
index bc54ae993..fd014efde 100644
--- a/plugins/GNUsocialPhotos/actions/photos.php
+++ b/plugins/GNUsocialPhotos/actions/photos.php
@@ -87,27 +87,15 @@ class PhotosAction extends Action
$username = $pathparts[0];
$this->elementStart('ul', array('class' => 'photothumbs'));
- //scorbett
- $photo_obj = new GNUsocialPhoto();
- $photo_obj->getGalleryPage(1, 0, 9);
+ $photo_obj= new GNUsocialPhoto();
+ $photos = $photo_obj->getGalleryPage(1, 0, 9);
- while (false !== ($file = readdir($dir))) {
- $fparts = explode('-', $file);
- if ($fparts[0] == $username // uploaded by this user
- && ((substr($file, -4) == '.png')
- || (substr($file, -4) == '.jpg') // XXX: is this needed? status.net seems to save jpgs as .jpeg
- || (substr($file, -5) == '.jpeg')
- || (substr($file, -4) == '.gif'))) { // and it's an image
- common_log(LOG_INFO, 'file : ' . $file);
- $this->elementStart('li');
- $this->elementStart('a', array('href' => 'http://' . common_config('site', 'server') . '/file/' . $file));
- if (!file_exists(INSTALLDIR . '/file/thumb.' . $file)) {
- photo_make_thumbnail($file);
- }
- $this->element('img', array('src' => 'http://' . common_config('site', 'server') . '/file/' . 'thumb.' . $file));
- $this->elementEnd('a');
- $this->elementEnd('li');
- }
+ foreach ($photos as $photo) {
+ $this->elementStart('li');
+ $this->elementStart('a', array('href' => $photo->uri));
+ $this->element('img', array('src' => $photo->thumb_uri));
+ $this->elementEnd('a');
+ $this->elementEnd('li');
}
$this->elementEnd('ul');
}