G2Image Version 2.2 - Released 24 Aug 07

capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Fri, 2007-08-24 14:37

Version 2.2 of G2Image, the Gallery2 Image Chooser, is out. Please download it here.

Changes:
-Eliminated use of G2 ImageBlock call in the backend. This eases getting information about a Gallery2 item.
-Updated the Album selection so that it loads all albums in a tree and automatically reload the page on album selection.
-Added support for a LightBox HTML tag and fullsized image HTML tags.
-FCKEditor integration
-Cleaned up the GUI a little (made the "sort by" and "images per page" select boxes force a redraw automatically instead of requiring another button press.)

Notes:
-G2Image 2.2 requires Gallery2 2.2
-Wordpress users should download the WPG2 v3.0 SVN snapshot, which includes G2Image 2.2 in its entirety. G2Image 2.2 is not backwards compatible with WPG2 2.1 or earlier.
-Joomla JCE users should leave the file zipped and install it using the plugins manager under the JCE component.

Demos:
TinyMCE
Standalone
Chinese Translation

Thanks to all who contributed ideas, language files, and beta testing,
Kirk

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2007-08-25 03:31

Great!
Added my Geeklog configs, and it seems to be working fine :)
A little more testing and I'll release it to the Geeklog community.
Was wondering which changes make it incompatible with Gallery 2.1?

-s
FlashYourWeb and Your Gallery

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Sat, 2007-08-25 04:58
suprsidr wrote:
Was wondering which changes make it incompatible with Gallery 2.1?

It's really just the two calls to GalleryCoreApi::getDefaultAlbumId in g2image.php

If you know another way to get the root album easily in G2 2.1, I'd be happy to switch it.

FYI, I'm also working on 3.0, which will have the ability to add multiple images at one time. I should have a beta out in a week or two, with final release in about a month.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2007-08-25 05:20

perhaps something like:
list ($ret, $albums) = GalleryCoreApi::fetchAlbumTree();
list ($ret, $albums) = GalleryCoreApi::loadEntitiesById(GalleryUtilities::arrayKeysRecursive($albums));
$albums[0] should be root.

I'm sure GalleryCoreApi::getDefaultAlbumId was added for more than convenience.
Maybe first check to see if the function exists before trying the other.

-s
FlashYourWeb and Your Gallery

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Sat, 2007-08-25 13:41

Thanks. I didn't know about that recursive galleryutilities call. That should do the trick. I'll give it a shot tonight. Assuming it's good to go, I'll release a 2.2.1 with the requirement relaxed to G2 2.1.x.

Cheers,
Kirk

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Sat, 2007-08-25 17:02
suprsidr wrote:
$albums[0] should be root.

$albums[0] turns out to be the first subalbum in the root album, so you can get the root album id with $albums[0]->getParentId().

I just need to finish modifying the code and do testing on several platforms to make sure that it works, and then I'll package it as 2.2.1.

I think the other thing that GalleryCoreApi::getDefaultAlbumId does is lets you get the default album for that user, which could be different than root. But it's worth opening it to G2 2.1 to get to the root in 2.1 and default in 2.2.

Thanks,
Kirk

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2007-08-25 17:56

Speaking of active user - are you checking the session for active user?(sorry I haven't looked over your code)
Something I do in my embed, is check to see if we are using the userAlbum module. If so, I give the active user a link to his/her album on the user menu.
Something that may be nice for 3.0 is to give the active user access only to albums owned by himself or he has permission to view. Of course root user would have access to all.
Also it would be nice to be able to actually embed audio/video items in stories/comments via G2Image not just link to them.

I noticed your wp demo seems to have styles in the G2Image popup, is there a place where we could attach our own style sheet? The standalone and my embed seems a little plain.

I really like the functionality better over 1.0 :)
-s
FlashYourWeb and Your Gallery

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Sat, 2007-08-25 17:58

Hmm, neither of these work to test if the function exists:

if (function_exists('GalleryCoreApi::getDefaultAlbumId'))
(function_exists('getDefaultAlbumId'))

It seems like one of them should work.

Any ideas?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2007-08-25 18:12

Couldn't you try executing GalleryCoreApi::getDefaultAlbumId and if it returns an error...

-s
FlashYourWeb and Your Gallery

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2007-08-25 18:15
 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Sat, 2007-08-25 19:19

Thanks. It didn't like method_exists, either. But now I know about that function!

Valiant told me to use

if (GalleryUtilities::isCompatibleWithApi(array(7,5), GalleryCoreApi::getApiVersion()))

where the 7,5 is from the API change for the function. API version 7.5 is where getDefaultAlbumId was added as documented here.

So, what I ended up with was

if (GalleryUtilities::isCompatibleWithApi(array(7,5), GalleryCoreApi::getApiVersion())) {
	list($error, $g2ic_options['root_album']) = GalleryCoreApi::getDefaultAlbumId();
}
else {
	list ($ret, $albums) = GalleryCoreApi::fetchAlbumTree();
	list ($ret, $albums) = GalleryCoreApi::loadEntitiesById(GalleryUtilities::arrayKeysRecursive($albums));
	$g2ic_options['root_album'] = $albums[0]->getParentId();
}

I'm not checking the active user now. But it is a good idea for 3.0.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2007-08-25 19:39

the else case should be:

	    list ($ret, $defaultId) = GalleryCoreApi::getPluginParameter('module', 'core', 'id.rootAlbum');
	    if ($ret) {
		return array($ret, null);
	    }

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Sat, 2007-08-25 19:54

Thanks, Valiant!