Cool js photo resizing effect

This commit is contained in:
Max Shinn 2010-12-28 09:38:50 -06:00
parent c73398fb25
commit 90521450a0
3 changed files with 43 additions and 2 deletions

View File

@ -199,5 +199,10 @@ class GNUsocialPhotosPlugin extends Plugin
{
$action->cssLink('/plugins/GNUsocialPhotos/res/style.css');
}
function onEndShowScripts($action)
{
$action->script('plugins/GNUsocialPhotos/res/gnusocialphotos.js');
}
}

View File

@ -83,10 +83,20 @@ class PhotosAction extends Action
if (!$album->find()) {
GNUsocialPhotoAlbum::newAlbum($cur->id, 'Default');
}
$this->elementStart('div', array('class' => 'galleryheader'));
$this->element('a', array('href' => '#',
'onclick' => 'increasePhotoSize()'), '+');
$this->raw(' | ');
$this->element('a', array('href' => '#',
'onclick' => 'decreasePhotoSize()'), '-');
$this->elementEnd('div');
while ($album->fetch()) {
$this->elementStart('div', array('class' => 'photocontainer'));
$this->elementStart('a', array('href' => $album->getPageLink()));
$this->element('img', array('src' => $album->getThumbUri()));
$this->element('img', array('src' => $album->getThumbUri(),
'class' => 'albumingallery'));
$this->elementEnd('a');
$this->element('h3', array(), $album->album_name);
$this->elementEnd('div');
@ -107,17 +117,28 @@ class PhotosAction extends Action
}
$photos = GNUsocialPhoto::getGalleryPage($page, $album->album_id, 9);
$this->elementStart('div', array('class' => 'galleryheader'));
if ($page > 1) {
$this->element('a', array('href' => $album->getPageLink() . '?pageid=' . ($page-1)), 'Previous page');
$this->raw(' | ');
}
if (GNUsocialPhoto::getGalleryPage($page+1, $album->album_id, 9)) {
$this->element('a', array('href' => $album->getPageLink() . '?pageid=' . ($page+1) ), 'Next page');
$this->raw(' | ');
}
$this->element('a', array('href' => '#',
'onclick' => 'increasePhotoSize()'), '+');
$this->raw(' | ');
$this->element('a', array('href' => '#',
'onclick' => 'decreasePhotoSize()'), '-');
$this->elementEnd('div');
foreach ($photos as $photo) {
$this->elementStart('a', array('href' => $photo->getPageLink()));
$this->elementStart('div', array('class' => 'photocontainer'));
$this->element('img', array('src' => $photo->thumb_uri));
$this->element('img', array('src' => $photo->thumb_uri,
'class' => 'photoingallery'));
$this->element('div', array('class' => 'phototitle'), $photo->title);
$this->elementEnd('div');
$this->elementEnd('a');

View File

@ -0,0 +1,15 @@
function increasePhotoSize() {
$('.photoingallery, .albumingallery').each(function(index) {
this.height *= 1.1;
this.width *= 1.1;
});
return false;
}
function decreasePhotoSize() {
$('.photoingallery, .albumingallery').each(function(index) {
this.height /= 1.1;
this.width /= 1.1;
});
return false;
}