How To - Drupal 4.7 TinyMCE embedded g2image

written by bmeredyk
Since I had a hard time getting this to work, I thought I'd post some instructions for others. 

Where to put files - this wasn't clear to me at all.
When you unzip the g2image package, you end up with a file structure like this:
tinymce_plugin/
tinymce_plugin/g2image/
wordpress_plugin/
CHANGELOG.HTML
CREDITS.HTML
README.HTML
(and a few other files)
You're going to want to upload the entire g2image/ folder that is within the

tinymce_plugin/ folder to your

<drupal_root_dir>/modules/tinymce/tinymce/jscripts/tiny_mce/plugins/ folder so you

have a final path of

<drupal_root_dir>/modules/tinymce/tinymce/jscripts/tiny_mce/plugins/g2image/
[Edit]
Another user kindly pointed out that your webserver - apache or whoever it is running

as - will need to have write permissions for the config.php file. Thanks Kaare for

pointing this out!
/modules/tinymce/tinymce/jscripts/tiny_mce/plugins/g2image/config.php
If you aren't lucky enough to have a hosting setup where php runs as your user,

you'll need to do the following.

Code:
chmod o+w ./modules/tinymce/tinymce/jscripts/tiny_mce/plugins/g2image/config.php #change above path to match your directory layout!
 
or use your ftp client to change the permissions.
Note, once the initial setup is finished, you can (and probably should) change the permissions back so
that not just anybody can edit your g2image config file. g2image *should* only need to write to that 
file when you first set things up. 
[/Edit]
If you're just setting up Drupal 4.7 like I was, you're definitely going to have a version of TinyMCE
newer than 2.0.3 so copy the two files found in the TinyMCE_version_2.0.3/ folder to the main g2image/ folder 
You're not done yet though, you need to let TinyMCE know that the new plugin is available before you
can actually use it. Open up the <drupal_root_dir>/modules/tinymce/plugin_reg.php file and add in the 
following two lines just above the line that says return $plugins; 
Code:
$plugins['g2image'] = array();
$plugins['g2image']['theme_advanced_buttons2'] = array('g2image');

All of the files for the plugin should be inplace now, so it's time to configure

Drupal itself.

Go to the Gallery module admin page (admin/settings/gallery) and under "Gallery

Image Assist (g2image) settings" set the mode to TinyMCE. Optionally you can set the

Default Action to insert a thumbnail and link to the image instead of using the filter

(I personally like to see the image inline). If you do choose to insert the thumbnail

you'll need to have the input type set to Full HTML (Filtered HTML doesn't allow img tags).

If you're going to stick with the "Gallery 2 Filter" you will need to enable it for the

preferred input formats. Go to admin/filters and for each format check the "Gallery 2

filter" box in the filters section.

Last, you need to setup the TinyMCE module to actually show the g2image button - go to

admin/settings/tinymce and select the profile(s) that you want the icon available in.

Under the "buttons and plugins" section chech the box next to the "Gallery 2 Image

Plugin" item.

You're finally done!


written by
bmeredyk
ref: http://www.galleryembedded.com/forums/viewtopic.php?t=3335

drupal - http://drupal.org (CMS, gallery.module)
gallery - http://gallery.menalto.com/ (gallery2)
tinyMCE - http://tinymce.moxiecode.com/ (embeded html editor)
Gallery2 image chooser - http://g2image.steffensenfamily.com (Plugin for tinymce to select gallery2 images)