Have anyone integrated Gallery2 as image gallery when writing articles in Tinymce?

I want to write articles in tinymce and pick photos from Gallery2 to put inline (and as the teaser picture) in articles. I want this to be fairly user friendly so that a user can either navigate through the gallery from tinymce, or that a user will find a picture in gallery and copy some link to paste in tinymce. Ideally, I would like to see the picture (or its frame only) inline with the text in tinymce.

The link on the picture in the article should lead to the picture in the gallery. Additionally, I would appreciate if it was possible to set the link manually to a) anything or b) relative inside my drupal site.

The teaser should preferrably have thumbnail size in news lists, and become a "normal" size (not full original size) in the article, but I only consider this as being a nice bonus.

Comments

scroogie’s picture

I second that, sounds like a very nice idea. But I dont know if its even possible. Doing this would need knowledge of TinyMCE plugins and filters, Drupal filters and Gallery2 image traversal. Might be easier to just extend the image.module to your needs?

scroogie’s picture

Well, shall we try to do this? The image_filter module and the drupal image tinymce module could be of help. What do you think?

capt_kirk’s picture

I’ve created a plugin for TinyMCE that allows you to choose an image from your Gallery2 photo albums by browsing thumbnails. You can insert a thumbnail with a link to either the individual photo or to the photo album. You can also insert a text link to either the individual photo or to the photo album.

I specifically designed this for use with Wordpress 2.0 using the WPG2 plugin, but I did design it so that it could be used without WordPress/WPG2. I have not extensively tested it outside of a WP environment, so I'd be happy to have some external testers. And you're obviously welcome to take the code as a start toward a Drupal-specific plugin.

The Sourceforge download page is: http://sourceforge.net/tracker/index.php?func=detail&aid=1395705&group_i...

My info page is: http://www.steffensenfamily.com/g2ic_plugin/

Screenshots: http://www.steffensenfamily.com/g2ic_screenshots/

scroogie’s picture

Nice work! Im currently installing a gallery2 on my 4.7 testbed and will test it this weekend.

capt_kirk’s picture

I've released version 1.1 of the Gallery2 Image Chooser plugin for TinyMCE.

The Sourceforge download page is still: http://sourceforge.net/tracker/index.php?func=detail&aid=1395705&group_i...

Info Page: http://www.steffensenfamily.com/g2ic_plugin/

Screenshots: http://www.steffensenfamily.com/g2ic_plugin/g2ic_screenshots/

scroogie’s picture

Great, thanks for your work!
Can we have two different views perhaps? The current one, and one as a table with smaller thumbnails? Because when you search for an image in a full gallery, its bit of work.
Btw. Would it be possible to upload images directly in this popup? And perhaps you can export an API which the img_assist could use, so that we have both Images of Image.module and gallery 2 in the same popup.

I dont know if these are good ideas, just some thoughts.

capt_kirk’s picture

Thanks. The table view is a great idea. I'll have to think some to implement it, though...

The upload may be more difficult to implement cleanly. I will put it on the wish list, though.

I'm really a WordPress guy, so I don't know what img_assist needs. Is there an easy tutorial on it?

henriklh’s picture

Thanks and well done! I will have fun with this during the week-end.

jivyb’s picture

I was trying to figure out how to get this implemented in my drupal tinymce and wanted to make sure there isn't anything I need to know before starting that is unique to drupal, as your instructions are for wordpress.

thanks.

gbs’s picture

I finally found your "how-to" at http://www.galleryembedded.com/forums/viewtopic.php?t=3335

I've been hinting to drupal folks that a "how-to" concept is a good idea.

So, I'm going to give gallery2 integration on drupal/timymce another try. I am chagrined that the info and details aren't on the drupal site itself and one must follow a number of links to find this. I notice your info page is a wiki, and the gallery forum is phpbb (a favorite of mine).

I told the folks at work that they really should adopt drupal instead of using wiki's. An important part of that is few employees are willing to use "mark-up" (other than perhaps html). The tools need to be point-and-click and as wysiwyg as possible. And images must be easy to handle. If I dont get image integ working drupal at work will die. And since this is the 4th or 5th largest software firm in the world it would be a shame if drupal doesnt get a fair chance. (Sorry, I cant say who it is I work for).

Sadly, the first demo of gallery I gave to a colleague required a [G2:picID] markup!!!! I am hoping this plugin will help that situation.

BTW, I tried acidfree instead of gallery and having an [acidfree:picID] markup is just as bad as having a [G2:] markup.
Nobody will use it if they have to learn code. Our wiki pages have a pittance of people who are willing to contribute because of this. And the alternative collaborative tool solution is *gasp* a microsoft tool called sharepoint.

I'm doing all this on my weekend spare time as I have to write C++ code during the week.

capt_kirk’s picture

RC1 for Version 1.2 is available at https://sourceforge.net/tracker/index.php?func=detail&aid=1395705&group_...

Version 1.1 had a bug that made it impossible to use outside of Wordpress. I've tested RC1 on my demo site in standalone mode. It should work with Drupal. I also added some notes in the init.php file for developers of Gallery2 embedded apps on how to add your own init function without having to get into the guts of the plugin.

There are two known issues that I'll fix before the final version, but I wanted to get it out for people to use for a week or two before going final. The feature set is locked, but if you find any bugs, please post them to this thread.

Known issues:
1. Folders with only numbers for a name, e.g., 2 or 35, are not detected.
2. RC1 is not compatible with the pre-release version 2.1 of Gallery2. It is fully compatible with G2 ver 2.0, 2.0.1, and 2.02.

There is a live demo at http://demo.steffensenfamily.com.

jivyb’s picture

Ok--I've been playing around with this in drupal and I'm wondering if a drupaller can tell me what file to edit to add g2image to the list of buttons. I've got the plugin in the right folder and everything is ready to go. I just don't know how to tell tinymce to add the g2image button to one of my themes. Can anyone help?

kiz_0987’s picture

I have this working in a 4.7 beta 3 Drupal embedded Gallery2 (2.0.2). capt_kirk this is an excellent plugin -- thanks for all your work.

I installed tinymce.module (cvs version 1.66) and tinymce 2.0.1 as per the tinymce.module instructions. Then I unzipped the g2ic_plugin into modules/tinymce/tinymce/jscripts/tiny_mce/plugins. To register the plug-in I modified the tinymce plugin_reg.php file (modules/tinymce/plugin_reg.php) to include the following lines:

$plugins['g2image'] = array();
$plugins['g2image']['theme_advanced_buttons2'] = array('g2image');

and it came up in the tinymce.module settings. I then selected the button and the plugin worked perfectly so far in FF. In Safari it doesn't work but that's no surprise given the limited Safari support in TinyMCE.

To support the left/right float, I added the following css into the drupal_g2.css file (if you are using the enhanced gallery.module):

.g2image_float_left img
{
  float: left;
  margin: 4px;
}

.g2image_float_right img {
  float: right;
  margin: 4px;
}

.g2image_clear_images {
  clear: both;
  }

I then included:

Clear Images=g2image_clear_images

into the tinymce.module settings page under CSS classes. The intent of this is to put in a small element with class g2image_clear_images in order to clear the images where you would like to on the page. It does not work fully yet -- standard css issues I'm sure.

mlr’s picture

Fantastic stuff thanks capt_kirk! I've been slowly working toward migrating my site from PostNuke / G1 to Drupal / G2 and this is the final piece of the puzzle.

I'm nearly there, but am getting a page not found when clicking on the "Insert a G2 Image" button on the TinyMCE toolbar. The URL in the address bar is ...drupal/modules/tinymce/tinymce/jscripts/tiny_mce/plugins/g2image/install/

Seems to be an odd URL for it to go to as we're not trying to install anything...

Drupal 4.6.3 (ok could try 4.6.5...)
g2image 1.2
Gallery version = 2.0.2 core 1.0.0.2
PHP version = 4.4.1 apache2handler
Webserver = Apache/2.0.54 (Fedora)
Database = mysql 4.1.12-standard-log
Toolkits = ArchiveUpload, Exif, NetPBM, Gd
Operating system = Linux barney.rothbaum.com 2.6.12-1.1376_FC3 #1 Fri Aug 26 23:27:26 EDT 2005 i686
Browser = Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

Any help would be appreciated (do I count as a beta tester ;-).

Thanks
Martin

capt_kirk’s picture

Martin,

Sorry for the delay in answering. I don't check this board very often.

I don't know much about Drupal. There is no g2image/install/ directory, so I'm not sure why it is looking for it. It may be a specific folder that the Drupal installation of TinyMCE is looking for.

If anyone figures this out and knows how I could correct for it in the G2Image code, please let me know. My contact info is located here. I'll be happy to roll a Drupal-specific fix into the code.

Kirk

Continental’s picture

My problem is near to what 'mlr' wrote. I installed TinyMCE, placed module inside, changed config.php in g2image dir for my gallery2/ path and when I press button G2: some page is loading, and I see PAGE NOT FOUND. When I go to drupal log I see:

internal_error.html not found
location: /modules/tinymce/tinymce/jscripts/tiny_mce/plugins/g2image/g2image.php?g2ic_tinymce=1

I really have this g2image.php at the stated path, but I don't know why it's broken.

I'm Drupal. 4.6.4 user
-------------------
Next step, I tried to inin g2image plugin in TinyMCE1.44 editor, but I didn't found any plugin_reg.php file. So, I did hack tinymce.module:

tinyMCE.init({
$tinymce_settings,
plugins : "g2image",
theme_advanced_buttons3_add : "g2image"
})

it this right or not? I just added g2button init and left the old settings. If you have something alse, please, write me.

May be I can upgrade my TinyMCE editor?

------------
I also shuld say that I user 1.3g2image pluging and Gallery 2.0.2.

thx u

capt_kirk’s picture

Continental,

Sorry. This was caused by a bug in 1.3. I created 1.3 by rolling the changes in 2.0 back to a Gallery2 2.0.2 environment. I changed all but one of the G2 2.1 calls back. Unfortunately, it was the one for non-WordPress initialization.

I thought I had tested it, but the WordPress installation on my testbed masked the error, even though I was using a standalone TinyMCE installation for testing. Lesson learned...

Version 1.3.1 is available here.

Once you get it up and running, would you please let me know if I got the Drupal G2 Filter implementation correct? Thanks!

Continental’s picture

Fiters are working! =)

Drupallers! Download new 1.3.1 and start using it, because I can't still understand if it working on not with 4.6.4. thx u. Currently I'm exeriencing a problems with broken thumnails. =(

capt_kirk’s picture

I think that when I fixed one non-WPG2 bug in 1.3.1 yesterday, I either didn't fix another or introduced another. I have to go back and look at the old files to see if I just missed one, or if I typo'd in a new one.

In any event, I've fixed it on my testbed, and have rearranged the non-WPG2 embedded initialization sequence. I'll put out 1.3.2 tonight.

Sorry for the flurry of buggy releases. I've been testing G2 2.0.2 and G2 2.1 in parallel, and I end up seeing cross-eyed trying to keep the changes I've made straight. I did some more thorough testing on the 1.3.2 changes, and I think they're solid. Please test 1.3.2 after I release it later tonight to see if it restores the thumbnails.

1.3.2 will have more configuration options in the config.php, so you'll be able to match the relative gallery2 path, embed path, and embed uri from your embedded application. Please check to see if helps make it easier to get the Drupal embedded Gallery to work with G2Image.

Thanks!

capt_kirk’s picture

I just posted 1.3.2. It fixes the last bug in non-WordPress initialization. I also rearranged init.php and config.php to make it easier use other embedded applications with G2Image. Now you can manually set your embedded paths, etc, in config.php.

My testing was masked before by the URL rewrite rules from my WordPress installation. I developed a more extensive testing program and proved that I can emulate my WordPress installation from my standalone testbed by setting the embedded paths correctly in config.php.

G2Image 1.3.2 should work with Drupal and Gallery2 2.0.2, now. Please let me know how it goes.

If 1.3.2 works correctly, I'll port the changes over to G2Image 2.0 to support Gallery2 2.1.

Thanks!

Canadrian-1’s picture

It would be ideal if this could make use of the G2 drupal text filter instead of coding an html link, because then the image is permalinked (as opposed to the current link, where the image will be broken if the image changes albums, or if the album it is in is moved). Also, Gallery 2.1 support would be really nice. Otherwise, great-looking module! These two things are the only factors keeping me from using it on my site.
----------
"Being tired is like playing mind games with some of the pieces missing."
- Canadrian

I am a proud member of the ElectricTeaParty.net online community.

capt_kirk’s picture

I just posted version 2.0 RC1 of the plugin which supports Gallery2 2.1 RC1 at http://g2image.steffensenfamily.com/index.php?title=Download

Using the G2 Drupal Text Filter sounds like a great idea. In the WordPress-Gallery2 (WPG2) plugin, we do the same thing with a WPG2ID tag and I've optimized the G2Image plugin to produce a WPG2ID tag for the WordPress crowd. It should be fairly easy to do the same thing for Drupal.

The reality is that I probably won't get to trying it until this summer or fall, because we're getting ready to sell the house and move. The coding I did to enable support for G2 2.1 is about the last big coding effort that my wife is going to let me get away with for a few months. :) If anyone else comes up with the code before I take a crack at it, I'd be happy to roll it into the code base.

Canadrian-1’s picture

Hey, thanks so much for getting 2.1 compatability out. That's totally awesome.

I'm just thinking if you already have a WP addon that generates links by item id, then the Drupal version sould be a piece of cake - all you have to do is make the tinymce addon output code like [G2:itemid] instead of <img src="/fullurltoimageoralbum"> (at it's most basic level anyway - there are other paramaters it could use, but those are not exactly essential for the average user). What I'm saying is, if your wordpress plugin already has a function to find the G2 item's ID, that's about all you need. Just tell people they would need the g2 textfilter plugin installed, and then it does the work.

(Wish I knew a damn about coding php so I could help...)
----------
"Being tired is like playing mind games with some of the pieces missing."
- Canadrian

I am a proud member of the ElectricTeaParty.net online community.

capt_kirk’s picture

[G2:itemid]

I didn't realize it's that easy. I just skimmed the documentation, and it really is that easy. I already have the entity ID, so it's just a matter of adding another radiobutton option and the corresponding insertion javascript.

I'll put it in the next release, with a config file setting for $g2ic_drupal_g2_filter = TRUE, to create the option in the window.

Give me a week or two, and I'll post news on here when it's done.

Kirk

capt_kirk’s picture

It turned out to be very easy.

I've implemented the Drupal Gallery2 Filter in the Gallery2 2.0.x version: 1.3 RC1 for Gallery2 2.0.x (locatedhere).

I'll have it in the Gallery2 2.1 version within a week or so. (I need to do a little more work to enable Gallery2 to be in a different subdomain before I release version 2.0 RC2.)

Could a Drupalier that uses the Gallery2 Filter test it out to see if I got it right. You have to set $g2ic_drupal_g2_filter to TRUE in the config.php to enable the option.

scroogie’s picture

Great, thanks! Ill test it right after my exams.

capt_kirk’s picture

I think that when I fixed one non-WPG2 bug in 1.3.1 yesterday, I either didn't fix another or introduced another. I have to go back and look at the old files to see if I just missed one, or if I typo'd in a new one. It results in broken thumbnails on the G2Image main window.

In any event, I've fixed it on my testbed, and have rearranged the non-WPG2 embedded initialization sequence. I'll put out 1.3.2 tonight.

Sorry for the flurry of buggy releases. I've been testing G2 2.0.2 and G2 2.1 in parallel, and I end up seeing cross-eyed trying to keep the changes I've made straight. I did some more thorough testing on the 1.3.2 changes, and I think they're solid. Please test 1.3.2 after I release it later tonight to see if it restores the thumbnails.

1.3.2 will have more configuration options in the config.php, so you'll be able to match the relative gallery2 path, embed path, and embed uri from your embedded application. Please check to see if helps make it easier to get the Drupal embedded Gallery to work with G2Image.

Thanks!

capt_kirk’s picture

Drupal Gallery2 Filters have been implemented in both Gallery2 Image Chooser versions 1.3 and 2.0.

v1.3 RC2 is for use with Gallery2 2.0.x

v2.0 RC2 is for use with Gallery2 2.1

Both can be downloaded here.

capt_kirk’s picture

My apologies, All. There was a bug in 1.3 that prevented non-WordPress initialization. I created 1.3 by rolling the changes in 2.0 back to a Gallery2 2.0.2 environment. I changed all but one of the G2 2.1 calls back. Unfortunately, it was the one for non-WordPress initialization.

I thought I had tested it, but the WordPress installation on my testbed masked the error, even though I was using a standalone TinyMCE installation for testing. Lesson learned...

Version 1.3.1 is available here.

capt_kirk’s picture

I just posted 1.3.2. It fixes the last bug in non-WordPress initialization. I also rearranged init.php and config.php to make it easier use other embedded applications with G2Image. Now you can manually set your embedded paths, etc, in config.php.

My testing was masked before by the URL rewrite rules from my WordPress installation. I developed a more extensive testing program and proved that I can emulate my WordPress installation from my standalone testbed by setting the embedded paths correctly in config.php.

G2Image 1.3.2 should work with Drupal and Gallery2 2.0.2, now. Please let me know how it goes.

If 1.3.2 works correctly, I'll port the changes over to G2Image 2.0 to support Gallery2 2.1.

Thanks!

pegmonkey’s picture

It works, but I do have one problem. The created url for the image contains two /gallery paths in it.. I've tried every combination of custom urls in the config.php that I can think of but no luck. For example..
http://www.pegmonkey.com/gallery/gallery/Motorcycles/Howto/Shadow+1100+C...

should be

http://www.pegmonkey.com/gallery/Motorcycles/Howto/Shadow+1100+Carb+Jet/...

If I disable embedded mode, I get

http://www.pegmonkey.com/gallery2/gallery/Motorcycles/Howto/Shadow+1100+...

If I use a '/' as the embedded url.. I get the correct URL link to the main picture, but I get no thumbnails.

Ok, just had an idea and tried. './gallery/' for the realtive gallery path.. and it works like that.

So, let me change my initial response.. It works great, once you figure out how to configure it. :D I leave my inept troubleshooting up there in case it helps anybody else...

So, to recap
I installed and integrated gallery2 with drupal as per instructions on the gallery2 pages.

I installed the g2image module in my tinymce plugins directory. Modified tinymce.module like continental did..

tinyMCE.init({
$tinymce_settings,
plugins : "g2image",
theme_advanced_buttons3_add : "g2image"
})

I told tinymce to use the advanced set in the drupal settings.

Then in the config.php for g2image I changed

$g2ic_embedded_mode = TRUE;

$g2ic_embed_path = '/';

$g2ic_embed_uri = '';

$g2ic_relative_gallery2_path = './gallery/';

Seems to work great.. thanks a bunch!!!!

Oh, I'm not using the g2filter btw, I like the idea of using real urls and html. I've been left hanging by drupal filters that were dropped with no easy upgrade path... hence my quest to use G2 for as much of my images as I can. At least till Drupal gets their image handling ironed out. So this is a great help. Hope my config info can help somebody..

Continental’s picture

pegmonkey, I should write before, to eliminate any troubles as I (and you) had. But if your g2image now working? I have some different config:

$g2ic_gallery2_path = «gallery2/»;
$g2ic_embedded_mode = TRUE;
$g2ic_embed_path = '/';
$g2ic_embed_uri = 'gallery';
$g2ic_relative_gallery2_path = 'gallery2';

gallery - is path you see you gallery under Drupal
gallery2 - us real path where gallery2 is installed.

With this config it's started working on my side.

I have not yet tested if thorought, but I experience some minor troubles at this moment I can't understand why:
- under FF G2Image button works only first time. When you type some text, then you press it and nothing happed
- I couldn't make working g2floating panel with options. Have not seen it.

btw, that g2image doing before it shows thumbnails? It seem to me thinking a lot, so it's a little bit slow... Anybody has the same?

p.s. g2filters didn't try. didn't know about 1.3.3 - have to see it. ;-)

mlr’s picture

Thanks for your message Continental.

Have just tried updating to g2image 1.3.3, with the settings recommended in http://g2image.steffensenfamily.com/index.php?title=Drupal.

I still get the same problem, the popup window gets redirected to modules/tinymce/tinymce/jscripts/tiny_mce/plugins/g2image/install/

The only tidbit I can offer that might help with tracking down what is going on is that the error log shows:

PHP Fatal error: Call to undefined function: galleryinitfirstpass() in /data/usr_local/drupal/gallery2/modules/core/classes/GalleryEmbed.class on line 80, referer: http://www.rothbaum.com/node/add/story

Cheers
MLR

capt_kirk’s picture

MLR,

Don't mean to blow you off, but I don't have a clue. Can any Drupaliers address what might be causing this in the Drupal GalleryEmbed.class?

(See my recent post at the bottom of this page on my sob story about not having a Drupal testbed. :) )

Kirk

Continental’s picture

I think that module should be moved in Drupal => Module with issues and all of that, but I don't know how it's usually approaching. There is no way to find it out amomgs the all Drupal posts... =)

capt_kirk’s picture

I've rolled the embedded application changes from 1.3.1 and 1.3.2 into the G2Image 2.0 branch. 1.3.3 fixes a bug for the WPG2 community that I introduced while fixing embedding for the Drupal and Joomla communities in 1.3.2. :)

G2Image 1.3.3 is for Gallery2 2.0.x

G2Image 2.0 RC3 is for Gallery2 2.1

Homepage: http://g2image.steffensenfamily.com/

I've also updated it so that it can either be used with TinyMCE or without it. I don't know much about Drupal, but it should be fairly easy to write a module to configure it without TinyMCE, too.

Demo with code explaining this: http://demo.steffensenfamily.com/

Thanks,
Kirk

capt_kirk’s picture

I've taken a first stab at a Drupal-specific page on the G2Image documentation: http://g2image.steffensenfamily.com/index.php?title=Drupal

I pulled the info from this thread. Would those of you who have been able to get G2Image to work please take a look at it to see if it is correct and complete?

Thanks!

pegmonkey’s picture

For me it works with either the settings I gave it, or the settings listed in the docs.

capt_kirk’s picture

pegmonkey, Thanks for checking!

I think that if you use Gallery2 URL Rewrites in embedded mode, you'll need to set the paths like continental did.

Have you or anyone else tried using G2Image 1.3.2 or 1.3.3 with embedded Gallery2 URL rewrites enabled?

pegmonkey’s picture

I'm using gallery/%path% as my gallery2 rewrite path embedded in a druapl install and it works. Like I said before, both configs seem to work fine for me. Not sure what the difference is... but I'm not worried about it. Working works for me. :D I'm sticking with yours and continentals configs.

pembeci’s picture

I just tested 1.3.3 with Drupal 4.6.5 and Gallery 2.0.2. The tinymce integration was great but I am not getting any thumbnails. The src and alt attribute of all the img's are empty. The gallery connection seems OK since I can see my albums and the filenames and titles of the images are listed correctly for every album.

My setup is:
document root: /var/www
drupal : /var/www/drupal (accessed by http://www.example.com by a virtual host directive)
gallery2 : /var/www/drupal/gallery2 (accessed by http://www.example.com/gallery from drupal as Gallery module requires and accessed standalone by http://www.example.com/gallery2)

I suspected the $g2ic_relative_gallery2_path value and tried different things ("gallery2", "./gallery" as suggested and their .. and trailing slash versions) but they didn't help. One thing I noticed during these tries was that although I was clearing the browser cache, sometimes I forgot to close windows from previous tries. Shall I just try all the combinations again? When I click on the tinymce image it remembers the last album I opened, is that normal?

I disabled URL rewrite in gallery2 but there was no difference (drupal configured for clean urls). Can my virtual host usage be the problem?

This is a great addition to the Drupal Gallery integration. Thanks for making it available to Drupal community.

capt_kirk’s picture

pembeci,

Yes, it's normal for G2Image to remember the last album visited, so that you don't have to browse though the whole album structure to insert several photos from the same album into one post. It only remembers for the current browser session. So, if you close the browser down completely, it will go back to your root album.

The "missing thumbnails" problem is usually because GalleryEmbedded is found but not properly initialized. Unfortunately, it doesn't return an error if it gets good strings on the initialization, even if they are invalid.

Since G2Image is finding your Gallery2 installation (or it would error out earlier), the embedded mode strings are suspect, as you thought. Unfortunately, I don't have a Drupal testbed to try to replicate this on. I'll set one up later this year (along with a Joomla testbed), but we're getting ready to move and my wife would shoot me if I set up more testbeds and do more active troubleshooting. :)

Could you look at the page source for the G2Image popup window and post the HTML for the img tag from one of the missing thumbnails? That might at least tell me how the GalleryEmbedded initialization is going.

pegmonkey’s picture

That's basically the same setup I have.

What are your other embedded settings?

I had a couple of times when I didn't get any thumbnails. I thought it was something misconfigured. But, now I'm not so sure. I just went and tried to break my configuration so I didn't get thumbnails, but it just kept working. I tried different browsers, clearing the cache but I still kept getting thumbnails. The setting that I "thought" broke my thumbnails was

$g2ic_embedded_mode = TRUE;

$g2ic_embed_path = '/gallery';

$g2ic_embed_uri = '';

I would get thumbnail placeholders, but no thumbnail images.

but that seems to work now for some reason. It seems to me something is getting cached somewhere.. drupal maybe? Squid on my firewall?

Continental’s picture

After moving my site to another host I got an error (both in 1.3.2 and 1.3.3) when I open window, and after nagivate somewhere (next albums) I see:
Fatal error: Call to a member function on a non-object in /home/bla-bla-bla/public_html/modules/tinymce/tinymce/jscripts/tiny_mce/plugins/g2image/g2image.php on line 172

Any ideas?

Drupal 4.6
G2IMage 1.3.x
TinyMCE
gallery.module
Gallery 2.0

p.s. Before migrating it worked!

pegmonkey’s picture

I'm not much of a programmer.. but I'd suspect something to do with the host server. Does everything else work.. drupal.. gallery etc? Do both servers use the same versions of php, apache etc?

Line 172 in my copy says $g2item_title = $item->getTitle() . "\n";
could it be a permissions problem? Is your gallery and drupal using the same user for authentication when you're working with it? I'm just taking shots in the dark..

Continental’s picture

During migration to new host, new users were making changes everyday, so I can't say exactly IF g2image worked before. May be not as I didn't check and can't check this now...

I have two parent albums, let's say:
- gallery (stable, changable only by admin)
- user albums (out of my managing).

When I open g2image and click to gallery, it is more or less ok, I can go further and further with albums, but when I approach the lower albums I DONT SEE PHOTOS. It's telling me there are no! (which is untrue). I don't remember if I had these before (may be...)

When I navigate to User Ablums I immediately SEE the error 172. My users use what they want in titles, they're not english, but with all it worked before...

Gallery and Drupal works fine after migration. Of course, hosting environment is different.

pegmonkey’s picture

What happens when you create an album in your user albums? Can you access it with g2image?

capt_kirk’s picture

The Gallery2 titles "shouldn't" affect G2Image. It's using the filename for a request to Gallery2, then Gallery2 spits out the title. So long as the directory name and file name are valid, G2Image is happy.

That said, there is obviously something wrong. How deep are some of the nested albums? I've only tested three deep, so I wonder if there is an accidental limitation on path length or something like that going on. I think that the GET is limited in allowed length, so a really long file path might cause an error if the GET is too long.

If that's the cause, I'll have to figure out another way to pass the info besides GET. Either a $_SESSION variable or using POST.

pegmonkey’s picture

I got the same 172 error. At first I thought it may have been because I used a ' in my album title.. but that doesn't seem to be the case. I first removed the images from the album and replaced them.. same error. I then deleted the album completely, recreated it and re-populated it. The error went away and I can now access the album correctly. Gallery2 acted like the album was fine. The only strange thing that happened was I had a picture fail to upload the first time around. I'm thinking that some of the data became corrupt or incomplete in the Gallery2 DB due to the failed/partial image upload. I'm out of time right now but will try and trouble shoot it again tomorrow.

pegmonkey’s picture

Ok, I found something out.. It might not be the same problem you're having continental.. I have a .jpg file (several actaully) that seems to be error free as far as I can tell. The only problem with it is when I upload it to gallery2 it errors out and tells me that it failed to import the file. If I have a gallery that works fine with g2image, after attempting to upload and having gallery2 fail to import the (defective?) jpg, g2image then bombs with the error 172. I checked the gallery2 database.. no problems there. Then, when I look at the actual directory that houses the album I was trying to upload to, there's an extra jpg. It's the jpg that gallery2 failed to import. So I delete the jpg from the storage directory. g2image then works fine.

I then copied a different jpg from another location into that directory. The jpg did not exist in the gallery2 database so gallery2 knew nothing about it. g2image broke again. It would work fine till I got to that directory.

Could that be what's going on with your install? Also, maybe check the permissions on the files in those directories.. it should be ok if gallery2 can see the images.

Does g2image check the physical file location as well as the DB? I'm fine with the way it seems to handle it since I like to keep my directories cruft free. Now that I know at least one thing that causes that error message I know what to check when I get it.

pegmonkey’s picture

capt_kirk.. I just re-read your explanation.. and now realize my question is redundant. :D So.. g2image queries the directory structure.. then finds file names and queries gallery2 for the titles.. If somebody has cruft in their directory.. extra files, then it seems to bomb. Could a more descriptive error message be programmed into that location? Could title retrieval be optional? Or could the file just be skipped if no title can be retrieved? I'm slowly learning php.. I'm going to look at the code and see if I can figure something out. But I'm not very good yet. Thanks again for a great plugin.. I'm really hooked on it.

capt_kirk’s picture

All,
Please move any further discussion to the G2Image - Drupal Forum that I set up on www.galleryembedded.com.

Thanks,
Kirk

asiafan’s picture

Thanks for this nice plugin, very useful!

I read that Default "How to Insert" Option - Valid options are 'thumbnail_image' 'thumbnail_album' ....

is there a way to instert the picture itself instead of a thumbnail?? its very limiting that i can only insert thumbnails while having custom formatted images in different sizes that i'd like to use.. could you please add an "insert image" option?

cgdigitaltreats’s picture

Awesome, I got through it.

Works great.

One problem and I think it's with the G2 plugin,
the gallery works, but when you click on an image it goes nowhere.

But when you go to the gallery folder, outside of drupal, and click on an image, it works.

Any ideas.

www.nyclightwave.com -----------Click on a gallery image, nothing happens.
www.nyclightwave.com/Gallery1 ----------click on an image it works.

Thanks.

Vito

lordzik’s picture

Hi,
first i must thank for great module! It really rocks :)

I think I've found a little bug: if i add an image from my gallery (in tinymce interface) and then another one just next to it and i press preview/submit my images appears one above one instead of one next to one. I guess there's
added by a "Gallery2 filter" because it happens only when i use G2: tagging.

Best regards!

foxtrotcharlie’s picture

I just installed g2image for use in tinymce, on Drupal 5.3. It's quite a simple process, so here's how I did it:

  • You obviously need to have gallery2 and tinymce installed already!
  • Download g2image from here: http://g2image.steffensenfamily.com/index.php?title=Download
  • Extract the zip file so that it sits in the tinymce plugin directory: /public_html/sites/all/modules/tinymce/tinymce/jscripts/tiny_mce/plugins/g2image
  • Add this to the file sites/all/modules/tinymce/plugins_reg.php just above the line "return $plugins;":
    $plugins['g2image'] = array();
    $plugins['g2image']['theme_advanced_buttons2'] = array('g2image');
    
  • No need for me to change the path to gallery2 in the g2image config file, as my gallery folder was in my root and called gallery2
  • Added the plugin to the tinymce profile I wanted it for: admin/settings/tinymce then choose the profile and add the Gallery 2 Image plugin button [should appear at the bottom of the buttons]
  • Opened up a content item with tinymce in a textarea and refreshed the page, and it was working...

Charles

www.parkroad.co.za

TechDust’s picture

Thanks for the info. I'm still having issues with this integration. oh well...
I think I will re-install everything and see where I am ;-)

picturebook’s picture

Thanks so much for your post foxtrotcharlie this (adding to the plugins_reg.php file) was the missing piece of the puzzle. Do you mind if I add this to the tinymce wiki?

afsousa’s picture

Hello Guys,

I have performed the full deal in integrating the Gallery2 button into TinyMCE, however after I add the button on the tinyMCE profile in the admin settings, no button shows up on the editor. Can anyone provide me with further clues regarding this issue?

Thanks!

willikins’s picture

Allo.

It seems that a few people have had this problem. I've seen it mentioned in other forums - whereby the installation appears correct, and the option for the plugin appears within the tinymce module profile, but no G2 button appears in the editor.

I had problems with it myself, and while this may be a very general solution to fixing this, and general stupidity on my part for not copping it earlier, I fixed it by re-installing an earlier version of the TinyMCE editor. When I was using tinymce 3.0, the plugin would not appear in the editor, but when I used tinymce 2.1.3 , it worked fine.

michaelwhitby’s picture

The TinyMCE module was replaced by WYSIWYG API - does anyone know the procedure to integrate G2Image with this new module?

I can get g2image to work with the old TINYMCE module, but not the new API.

helmo’s picture

Do you have a AegirCoop support subscription? See https://www.aegirproject.org/#support