Gallery 2.1 compatible gallery.module

lvthunder - January 17, 2006 - 18:28
Project:Gallery
Version:4.6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:walkah
Status:closed
Description

Has anyone modified the Integration code to reflect what is coming with G2.1. They have made changes on the gallery side for the integration to make it where g2 and the host app (drupal in this case) can be on seperate domains.

#1

walkah - January 17, 2006 - 18:34
Assigned to:Anonymous» walkah

i have actually begun some work on it yes... i will post here when complete.

#2

profix898 - January 18, 2006 - 23:14
Status:active» needs work

Hi!

I modified the gallery.module to work with G2.1 (CVS). Some code needed
to be changed in order to comply with new EmbedAPI and error handling.
The module works perfectly on my server with Drupal 4.6.5 and G2.1 CVS
for a few days now. Create/modify/delete user works without modifications.

BUT at the moment I was unable to put it to work with short URLs enabled
in G2. But I 'm not sure this is a gallery.module issue, because I cannot
have short urls activated in standalone mode (on my multisite/multigallery
installation) either.

I think the code needs some review and extension, but it works so far.

Regards Thilo

AttachmentSize
gallery_0.module 11.67 KB

#3

phildu - January 19, 2006 - 10:44

i'm interest , by the evolution of gallery integration;
but does you project to develop the essential (in my opinion,) feature
- the possibility to select a photo in the rich editor.
does the 2.1 permit this ?
where do you fin the version 2.1 i just found the 2.02 ?

thanks

#4

profix898 - January 19, 2006 - 14:02

- The module is simply a modification of the "original" one to make it
compatible with new G2.1 API. But it does NOT introduce any new
features.

- Gallery 2.1 is not yet released. You can find the beta versions at
http://gallery.menalto.com/downloads > Gallery2 > Nightly snapshots
(As far as I know G2.1 will be released end of February at the earliest)

- @ the possibility to select a photo in the rich editor.
Some people are working on that. At the moment you can only
use g2_filter. When you type [G2:item_id] in your editor, this tag is
replaced by the photo (with index item_id) on your page.
For more information look at http://drupal.org/node/40465
(This feature is (in my opinion) not limited by G2 API, but needs
much more work on the module.)

#5

kiz_0987 - January 19, 2006 - 14:37

Also check out http://drupal.org/node/41590 for TinyMCE support for Gallery2. Seems to work OK.

#6

Canadrian - February 17, 2006 - 07:31

Just wondering what the status of this is? With Gallery 2.1 RC1 out, I was wondering if 2.1 support is going to be made more a priority.

#7

dthiessen - February 17, 2006 - 15:34

Maybe it's about time someone set up a wiki so that all the small questions about intergration with different versions and such can be answered. It's confusing to keep track of where this module is in terms of development. If anyone is interested, I can host it or I'm sure almost anyone else could also.

#8

kiz_0987 - February 17, 2006 - 15:53

There is already a G2 codex page for drupal embedding (http://codex.gallery2.org/index.php/Gallery2:How_to_Embed_Gallery2_in_Dr... ) which deals with some of this. I suggest that we use a section in that or a new page on the codex site (if it gets too much).

#9

Johnyp - February 28, 2006 - 03:20

I've just tried the gallery_0.module posted above and it didn't work.

It seems that without someone getting paid for integration of G2 and Drupal, the 2 will always be out of synch. One app introduces a change, and the whole thing stops working. As soon as it gets fixed, there is another update or bug fix that puts it all back into non-functioning state.

#10

tHeDoc - February 28, 2006 - 12:32

Also tried the gallery_0.module posted here with no success. I'm using a very recent Gallery from CVS (with the API changes).

The error I get when activating the gallery block is:

Fatal error: Call to undefined method GalleryStatus::isError() in /var/www/html/drupal/modules/gallery.module on line 193

Hope this helps...

#11

Stardog - February 28, 2006 - 18:07

Here is the module I hacked up to work with my bleeding edge Drupal setup. This is for 4.7 (using with beta 4), and G2.1 RC 1b currently.

One thing not working yet is the URL rewrite. The rewrite module has changed in G2.1 and I haven't had time to figure it out yet.

Be sure to set access to the gallery in access control.

AttachmentSize
gallery_1.module 13.34 KB

#12

alexis - March 1, 2006 - 23:35

I'd also like to use G2.1 with Drupal 4.7 but before applying the patch I would like to know Walkah's opinion about it, I have a live site and wouldn't want to play with the gallery once my users are using it.

#13

dasalvagg - March 3, 2006 - 10:25

Good work on the module. I have it mostly working right now. Viewing the album works, but I am getting an error on a block.

Fatal error: Call to undefined method GalleryStatus::isError() in /var/www/localhost/htdocs/modules/gallery.module on line 233*

the offending code...

$block = array();
      list($ret, $content, $head) = GalleryEmbed::getImageBlock($params);
      if ($ret) {
        if ($ret->isError()) {
          gallery_error(t('Unable to get Gallery image block'), $ret);
          return;
        }
      } else {

*note-line number will be different. i've been playing with it.

#14

fazizi - March 9, 2006 - 02:44
Title:G2.1 Integration Code» (working) Patch for 2.1
Version:HEAD» <none>
Status:needs work» needs review

Hey all, I've never contributed to drupal before, in fact, just started installing it late last week.
But I like it so much and am in so in need of Gallery integration, that I decided to debug this myself.

The fix was pretty straightforward, after doing some digging.

As per

http://fisheye.gallery2.org/viewrep/gallery/gallery2/upgrade/index.php
1.23.2.1 annotated / raw | Diffs: previous, other | Lines: 264 ( +8, -8 )

Eliminate success(), isError() and isSuccess() from GalleryStatus.
The new pattern for error handling is:
$ret = someOperation();
if ($ret) {
return $ret->wrap(__FILE__, __LINE__);
}

I removed the offending isError() methods in gallery.module
Now it seems to work perfectly with Gallery 2.1 when creating and updating user accounts through drupal (i.e. they synchronize with the gallery users).

I based this on the gallery_1.module #11 submitted by Stardog on February 28, 2006 - 18:07

I am using Drupal 4.6 and the head of Gallery 2 CVS as of around the end of February, 2006 (so pretty much the Gallery 2.1 RC1 release)

Notes:
1) I had at least one user who could not see their equivalent gallery albums... I couldn't figure out why, but probably had something to do with the user being created before enabling the gallery module. I finally just changed the users username (in the user edit screen), created a new user, then updated the database to keep their nodes (update node set uid= where uid=), then deleted the old user

2) I disabled gallery's mod rewrite and also drupal's clean urls, since it didn't seem to work with them on

There doesn't seem to be a drupal gallery navigation block with this version though :( Maybe someone can patch it up.

Hope this works for you!

p.s. I would appreciate someone designing a nice drupal-friendly gallery theme :)

AttachmentSize
gallery_2.module 16.56 KB

#15

euphi - March 10, 2006 - 15:42

There is an extra line at the end of file, so installing the module will result in empty pages and "headers already sent" warnings.

Just remove the last (empty) line of gallery_2.module.

Euphi

#16

fazizi - March 11, 2006 - 22:07
Title:(working) Patch for 2.1» fixed newline and added search patch
Version:<none>» 4.6.x-1.x-dev

I fixed the newline thing and also added the search patch from http://drupal.org/node/34301.

thanks,
Fi

---------------------------------------
Fairiz "Fi" Azizi http://www.fairizazizi.com

AttachmentSize
gallery_3.module 13.87 KB

#17

fazizi - March 11, 2006 - 22:23
Title:fixed newline and added search patch» Gallery 2.1 compatible gallery.module

FYI, there are some additional improvements on the gallery module on this thread http://drupal.org/node/32393
However, it doesn't seem to have 2.1 support.
We should merge these two "branches" of code together... Maybe I'll do it someday when I have time... but I would suggest Walkah since he was the original author.

#18

Michelle - March 11, 2006 - 22:32

fazizi:

My understanding of the issue is that Walkah would like the enhancements as individual patches instead of a forked module as kiz_0987 has provided. If you have the time and ability to break kiz_0987's module up into patches that Walkah could use, there are a lot of us that would love you forever. :)

Thanks,

Michelle

#19

sethcohn - March 13, 2006 - 22:00
Version:4.6.x-1.x-dev» HEAD

The above module code are _not_ 4.6 compatible, so I'm setting the version to cvs (as there is no 4.7 option).

Is there a working Drupal 4.6 + Gallery 2.1 module at this time?

#20

darius - March 13, 2006 - 22:02

I am attaching a patch for the *official* CVS version of gallery.module to make it work with Gallery 2.1.

AttachmentSize
patch_32 4.63 KB

#21

Whazz - March 15, 2006 - 22:15

I'd like to get a working Drupal 4.6 + Gallery 2.1 module too. :(

It would be greatly appreciated!

thx in advance!

#22

darius - March 15, 2006 - 22:50

Updated patch for the CVS version of gallery.module. Incorporated changes to GalleryEmbed::init detailed in http://codex.gallery2.org/index.php/Gallery2:Integration_Howto

Please note that you will probably have to go to the settings and add a starting slash to the location of gallery2 installation.

Please review!

Darius

AttachmentSize
patch_33 7.08 KB

#23

muchio - March 16, 2006 - 15:30
Category:feature request» support request

Hi, I'm not sure if it is related to the patch, but I've noticed, that if you try to load gallery with the trailing slash at the end (i.e. drupal.site/gallery/ ), css gets messed up.

#24

Johnyp - March 24, 2006 - 05:18

So Gallery 2.1 is officially out. Drupal 4.7-beta_6 is current with a good chance of official 4.7 in a month and a half. Any update on making 2.1 and 4.7 working together and living happily ever after?

#25

kiz_0987 - March 24, 2006 - 14:21

Gallery2.1 with Drupal 4.7 (cvs) committed to CVS HEAD. Please let me know of any issues and provide any relevant patches to this version. Note that the gallery-cvs.tar.gz (from http://drupal.org/project/Modules/cvs/) will be regenerated automatically later today. In the meantime you will need to go to the Drupal CVS to download.

Features:
- Compatible with Gallery2.1 and Drupal 4.7 (ONLY!)
- Autoconfiguration of settings (only 1 parameter is needed) with checking
- Drupal Role & Gallery2.1 Group support (with automatic sync)
- Improved user information (can check Drupal-G2 sync status) with Full-Name support (via profile.module)
- Improved URL rewrite - any rule can now be used, not just the view rule.
- Can change number of images in sidebar and they can be different types
- Can add photo frames and link target
- Support for Gallery2 Navigation menu in sidebar (including Album Select)
- Adds breadcrumb
- Adds css file to improve default Gallery2.1 Matrix theme for embed.
- Improved search, with thumbnails and paging
- Includes g2_filter functions
- Includes support for g2image (http://g2image.steffensenfamily.com/) both Standalone and with TinyMCE

#26

alexandreracine - March 26, 2006 - 01:32

fazizi, your module on comment #16, does not work.

For example, in the config area, there is nothing.
Also, the gallery works within drupal, but all pictures are not there...

#27

KarenS - March 27, 2006 - 19:57

Ran into one small problem. The nice message telling me that my users are or aren't synched with Gallery is visible to anonymous users. I think the following will fix it (works for me)

In gallery_user.inc, around line 159

change
function gallery_view_user($user) {
  $g2_userinfo = gallery_user_info($user, true); 
  if ($g2_userinfo['error_msg']) {
   
to
function gallery_view_user($user) {
  $g2_userinfo = gallery_user_info($user, true); 
  if ($g2_userinfo['error_msg'] and user_access('administer users')) {

#28

kiz_0987 - March 28, 2006 - 00:37

Committed the user access change. Thanks KarenS.

#29

KarenS - March 28, 2006 - 09:54

One more change to recommend:

I have a multi-site installation and not all the sites need Gallery. At the same time, I am using very close to the maximum amount of memory for some sites. To control memory, I need to turn off some modules that use a lot of memory (like Gallery) but because other sites are using the module, I need to keep it in the modules directory.

I ran out of memory for one of my sites and started turning off some modules, including Gallery. To my surprise, I started getting out of memory errors from the Gallery module! I did some digging and the offender is the very beginning of the module which is loading gallery_init if the gallery module is in the directory, whether or not it is enabled. First I added a clause to load it only if the module was enabled, but then I started getting several "function does not exist" errors for functions in the module, so I had to add some stub functions if I didn't load gallery_init. The fix I finally came up with was to change the beginning of the module as follows (and this solved my memory problems on the sites that had it turned off:

if ($path = drupal_get_path('module', 'gallery') and module_exist('gallery')) {
  require_once($path . '/gallery_base.inc');
} else {
  function _gallery_init() {
    return;
  }
  function gallery_error() {
    return;
  }
}

#30

KarenS - March 28, 2006 - 09:59

When I talk about loading gallery_init I mean gallery_base. Also, you may wonder why it is doing anything with the module when it is not enabled (so did I) but on the admin > modules page, at least, it gets loaded anyway and creates my problems.

#31

nydrupalfan - March 29, 2006 - 05:51

Thanks for the work on the module! I can't seem to get the user role <-> group integration working. The drupal roles do not appear in the gallery group list (even after making changes to the roles) using drupal cvs and gallery 2.1. Could someone describe how this feature is supposed to work and what I might be doing wrong?

#32

kiz_0987 - March 29, 2006 - 11:27

The role/group sync between Drupal and G2.1 does not happen when a role is added/deleted, but instead when a user is edited to be in that role (in fact on any user edit). So edit a user to include them in the new role and see if it works then.

#33

nydrupalfan - March 29, 2006 - 17:08

Thanks for the quick response. I'll try editing a user tonight. Do you only need to edit one user from each role? Or do you need to edit every user on the site for the sync to work correctly?

#34

kiz_0987 - March 29, 2006 - 17:13

The way it works is:
- When a user is modified, *all* the roles defined in Drupal are sync'd (add/delete) with Gallery2. Note that groups defined in Gallery2 are not carried over into Drupal (ie it's unidirectional). The G2 group membership for those groups/roles now includes this user.
- There is no global sync of all users in the Drupal code, so the other users are not yet part of the Gallery2 groups until they are also modified.

#35

alexandreracine - April 4, 2006 - 20:16

For a working Gallery 2.1, Drupal 4.6.x, and gallery.module 4.6 , go at this address.

http://drupal.org/node/57321

#36

bharat - April 19, 2006 - 05:06
Version:HEAD» 4.6.x-1.x-dev
Status:needs review» reviewed & tested by the community

Here is a patch against DRUPAL-4-6 to bring gallery.module up to the code that we use on the Gallery website itself (http://gallery.menalto.com). It works with Drupal 4.6.6 and Gallery 2.1. Note that this *will not* work with Gallery 2.0. I don't know how Drupal typically versions something like this -- perhaps it makes sense to ship two versions of gallery.module and let the user decide which one to use depending on which version of Gallery they have installed.

http://www.menalto.com/.outgoing/gallery/Gallery2.1-with-Drupal4.6-patch...

#37

kiz_0987 - April 19, 2006 - 11:07
Status:reviewed & tested by the community» fixed

Bharat's patch has been committed into the CVS for version 4.6. There is now gallery.module (G2.0) and gallery.module.G2.1 (G2.1). When using Gallery2.1 you have to remove/rename gallery.module and rename gallery.module.G2.1 to gallery.module, as explained in INSTALL.txt.

Thanks Bharat.

#38

bharat - April 20, 2006 - 04:02

That was mighty fast. Thanks, Kieran!

#39

Anonymous - May 4, 2006 - 04:15
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.