g2image TinyMCE popup - wrong path?

narzus

Joined: 2007-11-30
Posts: 4
Posted: Fri, 2007-11-30 11:31

When I click on the g2 icon in visual editor or the WPG2 button in non-visual editor, the popup window shows a 404 file not found (on a normal wordpress output page). Firefox, Safari, Opera, all fail. The "WPG2 Album Tree" widget doesn't work too.

It's not a browser issue since the demo works:
http://demo.steffensenfamily.com/demo_tinymce.html

I have a standard clean and fresh WP/Gallery2 installation (latest official builds) both on the same domain, and everything works except the g2-button when writing/editing a page.
No plugins activated, it's a fresh installation. Default WP theme or classic theme activated.

WPG2 path settings are standard:
Gallery2 URL (where my gallery sits): http://mydomain.com/fotos/
Gallery2 File Path (server relative path): /home/myaccount/public_html/fotos/

The gallery2 admin user is listed correctly in WP (Wordpress Users with Gallery2 admin accounts).

Analysing the javascript shows that the popup-link defined in "function g2_open()" is:

var form = 'post';
var field = 'content';
var url = 'http://mydomain.com/wp-content/plugins/wpg2/g2image/g2image.php?g2ic_form='+form+'&g2ic_field='+field+'&g2ic_tinymce=0';
var name = 'g2image';

Which is rather odd since the variables "form" and "field" are already defined.

Therfore I removed the variable chunk after g2image.php:
var url = 'http://mydomain.com/wp-content/plugins/wpg2/g2image/g2image.php?g2ic_tinymce=0';

After that the popup works and shows my gallery tree incl. all images.
Also the "WPG2 Album Tree" is displayed and works well now.
But inserting images from the popup doesn't work! No reaction be it text link, thumbnail or full-size image.

Additionally the Gallery2 users panel (site admin) shows a "Failed Login = 1" (but never above 1 even if I tried 20 times to insert images). I suppose this happens when activating the WPG2 plugin - is it necessary for the WP and the gallery user to share the same password?

Any ideas? I'm clueless.
Didn't find anything on the web regarding this issue (similar, but not the same).

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Fri, 2007-11-30 21:14

In wpg2/g2imageplugin.inc, around line 354, this code

var form = 'post';
var field = 'content';
var url = '<?php echo $g2image_url; ?>g2image.php?g2ic_form='+form+'&g2ic_field='+field+'&g2ic_tinymce=0';

could have been written as

var url = '<?php echo $g2image_url; ?>g2image.php?g2ic_form=post&g2ic_field=content&g2ic_tinymce=0';

It means the same either way. But it has to be there or g2image doesn't know where to insert the code that it generates. (I left it the way it is to make it easier to make form and field actual variables instead of just fixed strings. As it turns out, we've never needed to make them variables, but it works either way.)

Try the Wordpress demo, http://demo.steffensenfamily.com/wordpress/ Does it work there? How about on the standalone demo: http://demo.steffensenfamily.com

What exact version of WPG2 are you using? I'm guessing 3.0.2 from the WordPress plugins pages, but wanted to make sure.

Since the 404 is a WordPress 404 (WP header and footer with the WP 404 message), I'm thinking it must be a WP rewrite problem. We've never seen this (in thousands of installs), so it's really strange. Do you have any WP permalink structure activated? If so, is it a fairly standard one? EDIT: I just rethought this question. Since you're getting the popup without the form and field variables, I don't think it's a rewrite issue.

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website

 
narzus

Joined: 2007-11-30
Posts: 4
Posted: Sat, 2007-12-01 07:08

Captain Kirk,

believe it or not - it works now and I swear I didn't change anything except set the line back to original.
The only thing I did was replacing all files in my www directory to see if something's wrong with the files.
So I moved all files outside to a temporary folder, unzipped wordpress-2.3.1.zip into the www dir and of course also copied the old config.php in order to use the same database. I also did this because the TinyMCE stopped appearing in visual mode, it only works in non-visual. That issue is not related to WPG2 since it occured before. And yes, all checkboxes are set, I even set the advanced option flag directly in the database. But replacing the files in www didn't help, same issues as before so it must be database related, I concluded - but it's not, even with a fresh database I got the same issues. Finally I moved back all files from the outside temporary folder back to www and waited for a reply to my post here.

A second and a third test install in parallel folders work, TinyMCE appeared but had the same issue with WPG2 - until "it got fixed" magically over night.
The test installations now work 100%, no issues left. All that doesn't work is TinyMCE in visual mode on the main installation (www dir).

A few days ago TinyMCE reappeared all of a sudden, but a day later disappeared again. I got the impression that some browsers break "something" - even replacing all files OR the database won't help. Could that be folder related, a permission problem? Could it be some php-related side-effect, probably from other users? I can't really imagine though. I'm on a shared hosting (Site5) and these irregularities are more and more suspicious to me.

Guess I have to start all over (again) and drop my database. I worry that the visual editor or gallery chooser might stop working when users are active on either blog/gallery. Can't just delete the db and start over then.

What I use:
wordpress-2.3.1.zip
gallery-2.2.3-typical.zip
wp-wpg2.3.0.2.zip
PHP 4.4.6
MySQL 4.1.22

Anyway, thanks for your quick reply Kirk! You seem to be very active on the forums and always there for help.
Thanks for providing such a great plugin!

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Sat, 2007-12-01 11:27

Narzus,

Thanks for letting me know. Glad it's working!

This is the most frustrating type of bugs, one that doesn't have an apparent cause and automagically cures itself. Please let us know if it reappears and we can try some more detailed troubleshooting.

TinyMCE working or not *should not* have anything to do with the PHP side, unless there is a problem with the WP files that cause it to be included as javascript in the output to your browser. Once it's in your browser, it's pure javascript that does not interact with the server other than to get popup windows for some of the editor buttons.

If this happens again, check from another computer. Preferrably from another network, like at work or have a friend check it. Just to make sure that it's really a server issue.

Good luck.

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website

 
narzus

Joined: 2007-11-30
Posts: 4
Posted: Sat, 2007-12-01 19:39

Kirk,

one couldn't express it better, it is indeed frustrating and I wasted around 3-4 days on that, erm issue(?)...
Whatever, I'm happy the g2image chooser works now.
As for TinyMCE, it's really odd since the visual editor works absolutely normal on my test installations (located in subdirectories).
Also your demo sites work well (thx for the links), therefore it can't be browser or javascript related.
Only the installation in my www root won't work, even if I replace all files...
And shifting all files to a subdirectory didn't change anything.
I'm beginning to believe that I'm an idiot...

But good to know Captain Kirk is there to help with Warp-10!

Will start all over again and let you know if that did the trick.
Thanks for your help, Kirk!

Narzus

 
narzus

Joined: 2007-11-30
Posts: 4
Posted: Thu, 2007-12-06 09:38

Note regarding WPG2 button+popup in visual editor.
I never had this issue but it might help someone else in trouble.

Clicking the WPG2 button might result in a popup with a "404 file not found" error embedded in a normal Wordpress page.
This can occur if the file/folder permissions on the server are incorrect (i.e. WPG2 plugin folder).
If your webhost is rather restrictive, files/folder with too open permissions may not be executed.
That's the case with my webhoster (Site5), only 755 folders and 644 files are allowed, everything above gives a standard white error page.

The 404 error is misleading since it's the plugin that could not be executed.
Set the right permissions and the gallery popup works.

For people with shell access, do it the easy way.

This command sets all folder within the CURRENT directory and below to 755:
find . -type d -exec chmod 755 {} \;

This command sets all files within the CURRENT directory and below to 644:
find . -type f -exec chmod 644 {} \;

 
qwik3r

Joined: 2007-08-20
Posts: 60
Posted: Wed, 2008-06-04 23:20

Why the hell does my entire gallery inside of my wordpress page popup when I click the G2 button? I am using wpg2 3.06 and wordpress 2.5.1

 
ozgreg
ozgreg's picture

Joined: 2003-10-18
Posts: 1378
Posted: Thu, 2008-06-05 03:05

Hiya qwik3r,

Your entire Gallery2 actually does not load, only the current selected album. G2image is a selection tool, it is designed to display the photos from the relevant album and you select the photos you want to be inserted into your blog entry.

____________________________________
Wordpress / Gallery2 (WPG2) Plugin, , WPG2 Documentation, WPG2 Demo

 
qwik3r

Joined: 2007-08-20
Posts: 60
Posted: Mon, 2008-06-09 02:12

problem resolved by setting the folder to 755