I have multisite installs of both Dupal and G2.3. Drupal is installed in the webroot and I have three subdomains pointed to it. They are:
http://photo.lvthunder.com
http://cabin.lvthunder.com
http://www.lvthunder.com (doesn't use G2 at all)
I have G2.3 RC1 installed in /gallery2 to use with photo.lvthunder.com and the multisite in a folder called cabing2. I have all the drupal modules in the modules folder so both sites use the same sets of files. The problem is I set up G2Image in the cabin site last and now when I'm in the photo site when I use G2Image I see the cabin G2 albums not the ones for the photo site.
Comments
Comment #1
profix898 commentedShort answer (long answer may follow tomorrow when I plan to work on the major issues for G2.3+D6):
G2Image is not multisite-aware. You can run G2 and gallery module from a single codebase, but you must install G2Image (and gallery_g2image?) in separate locations (/sites/x/... seems reasonable). G2Image is configured using a config.php file in G2Image's root folder. To have G2Image work with multiple galleries you also need multiple config.php files, but the path to config.php is not configurable. For that reason you need separate installs ...
Comment #2
thumb commentedIf you're willing to manage merges when g2image updates come out, you can perform the following edit to to make g2image multisite aware. Edit the g2image config, mine is located at drupal/sites/all/modules/tinymce/tinymce/jscripts/tiny_mce/plugins/g2image/config.php.
I added line 20 to set the host name minus 'www.' to match Drupal multisite folder names. Then edit lines 22 and 24 to add the host into g2image path variables.
20 $multisite_host = preg_replace('/www\./', '', $_SERVER['HTTP_HOST']);
21 $g2ic_embedded_mode = TRUE;
22 $g2ic_gallery2_path = '/var/www/html/drupal/sites/'.$multisite_host.'/gallery2/';
23 $g2ic_use_full_path = TRUE;
24 $g2ic_gallery2_uri = '/sites/'.$multisite_host.'/gallery2/';
Comment #3
profix898 commentedI think we should call this a "feature request". Multisite support is on the requested features list already, but apparently Kirk didnt have time to work on the next G2Image release. If time permits I will write him about this and ask for his progress on an item selector mode for GalleryField. IMO multisite support requires a small patch to G2Image only and also some lightweight changes to gallery module, but it shouldnt be really difficult to get this done by the next version of G2Image.
Comment #4
thumb commentedIf the above approach seems reasonable, I'd be happy to submit a patch.
Comment #5
lvthunder commentedOK I edited that file, but at the top it says not to edit it. When does that file get overwritten? Is it only when you go to the G2Image tab in the gallery settings.
Comment #6
profix898 commented@thumb: The approach you posted above is a quick hack to G2Image and it is working, but it is not really reasonable IMO. Its not a true multisite solution from Drupal's perspective. Your changes to G2Image support multiple G2 installations, but they dont allow multiple Drupal sites to configure G2Image individually. A true multisite solution should really support separate configurations for each site. With your hack above all options are global to all G2Image instances, e.g. you cant have different custom css classes and stuff like that.
I think G2Image should be modified to support "profiles". A profile - as I think of it - is a set of options, similar to config.php now. A profile should also contain a list of feature, i.e. what options should be exposed to the user (size, format, ... selector or do you know the "basic" and "advanced" modes in TinyMCE). This way we could associated a subset of available profile with a Drupal/G2 site and we could even provide different selector modes to the user. The latter point is especially useful for hiding certain options (e.g. the ability to generate html instead of G2: filter tag) from the user or to have a simple id browser mode with all user options hidden.
@lvthunder: Yep.
Comment #7
lvthunder commentedI adapted what thumb did and for my site came up with this.
So I think if then statements could be made for multisites.