no thumbnail in e107 forums

Rash

Joined: 2006-03-04
Posts: 54
Posted: Thu, 2007-10-04 16:09

I've been using g2IC as a tinyMCE plugin in my e107 CMS successfully for a while now. However, it's recently come to my attention that thumbnails aren't showing on images inserted into forum posts. The thumbnails work great for news posts, but in the forums, a link to the Gallery item is created, but a text link is created instead of a linked thumbnail image.

I've reproduced this with v3.01 of g2IC, using Gallery 2.2.2, and e107 v0.7.8.

I suspect it may have something to do with how the e107 forums are in a different directory....

the locations of the various programs are:
gallery: /home/user/public_html/g2/
gallery embedded app: /home/user/public_html/e107_plugins/gallery2/gallery2.php
TinyMCE: /home/user/public_html/e107_handlers/tinyMCE/
g2IC: /home/user/public_html/e107_handlers/tinyMCE/plugins/g2ic/
e107 forums: /home/user/public_html/e107_plugins/forum/

any ideas?

Thanks!
Rashan

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Thu, 2007-10-04 16:16

Rashan,

I haven't used or tested with e107, yet. Please tell me some more about how you have the embedded settings in g2image/config.php.

Also, if you don't mind, please either post or PM links to your main e107 site and the associated forums (or is it really all one thing?)

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

 
Rash

Joined: 2006-03-04
Posts: 54
Posted: Thu, 2007-10-04 16:58

Sure thing!

http://www.hagan-net.net/
forums: http://www.hagan-net.net/e107_plugins/forum

heh. and actually, to make this more interesting, I mispoke above on my g2IC version. I was actually using v2.3 (I think) with the old style of navigation. So, I just updated the site to use g2IC 3.01 (to see if that fixed the forum issue) and now it wont insert images at all... well, golly. :( I can place a checkmark in hte box on a photo in the g2ic window, but the "insert" button doesn't become active. Additionally, the 'check all' and 'uncheck all' options do not check or uncheck any of the photos either.

well... glad I could make things worse. ;)

anyways, here's the content of config.php. Is there anything else I can provide? If you need access to look at things, I can arrange that as well. Thanks!

Rashan

<?php
/*
    Gallery 2 Image Chooser
    Version 3.0.1 - updated 26 SEP 2007
    Documentation: http://g2image.steffensenfamily.com/

    Author: Kirk Steffensen with inspiration, code snipets,
        and assistance as listed in CREDITS.HTML

    Released under the GPL version 2.
    A copy of the license is in the root folder of this plugin.

    See README.HTML for installation info.
    See CHANGELOG.HTML for a history of changes.
*/

// WORDPRESS USERS STOP HERE!!!
// WORDPRESS USERS STOP HERE!!!
// WORDPRESS USERS STOP HERE!!!
// NOTE: WordPress users should change all of the remaining settings using the
// "G2Image Popup Options" admin panel in WordPress.

// If $g2ic_use_full_path is set to FALSE (default setting - in EMBEDDED MODE
// OPERATIONS at the bottom of this file), then $g2ic_gallery2_path is
// the path from your web root directory to your Gallery2 directory.
// Example: If your Gallery2 homepage is www.domain.com/gallery2/main.php,
// then g2ic_gallery2_path is "gallery2/".
// Make sure you include the trailing forward slash.
//
// If $g2ic_use_full_path is set to TRUE, then $g2ic_gallery2_path is
// the full directory path to your Gallery2 directory.
// Example: /usr/username/public_html/gallery2/
// Make sure you include the trailing forward slash.

$g2ic_gallery2_path = "/home/hagatnet/public_html/g2/";

// Set the language for the main g2image popup window.
// There must be a corresponding xx.mo file in the g2image/langs/ directory.
// If there is not a corresponding xx.mo file, English will be used.

$g2ic_language = 'en';

// Change this for more/fewer images per page.

$g2ic_images_per_page = 15;

// This sets the default view.  If set to TRUE, titles, summaries, and
// descriptions will be displayed.  If set to FALSE, only the thumbnails will
// be displayed.

$g2ic_display_filenames = FALSE;

// This sets the default alignment option.  Valid options are  'none',
// 'g2image_normal', 'g2image_float_left', 'g2image_float_right',
// 'g2image_centered', and one of the class names entered in the custom classes
// below.  Using 'none' will result in inserting an img tag with no class
// attribute.  See README.TXT for implementing CSS to support the g2image
// classes necessary for this option.

$g2ic_default_alignment = 'none';

// You can define custom class names for your img tag.  If these are set to
// anything other than 'not_used', they will be available under the
// alignment/class selector.  You can make it the default class by entering it
// in $g2ic_default_alignment above.

$g2ic_custom_class_1 = 'not_used';
$g2ic_custom_class_2 = 'not_used';
$g2ic_custom_class_3 = 'not_used';
$g2ic_custom_class_4 = 'not_used';

// This sets the default URL for the Custom URL option.

$g2ic_custom_url = 'http://';

// Change this to determine where the alignment class will be inserted.
// Valid options are 'img' to have it inserted as <img class=...> or
// 'div' to have it inserted as <div class=...><img ...>.
// If you choose 'div', you will have to manually delete any <div> tags manually
// after deleting images from the TinyMCE window.
// This setting will not affect <wpg2> tags, which are always wrapped with a
// <div> tag, if using g2image alignment classes for the <wpg2> tags.

$g2ic_class_mode = 'img';

// Change this to change the default "How to Insert" option.  Valid options are
// 'thumbnail_image', 'thumbnail_album', 'thumbnail_custom_url', 'thumbnail_only',
// 'link_image', 'link_album', 'drupal_g2_filter', 'thumbnail_lightbox',
// 'fullsize_image', and 'fullsize_only'.

$g2ic_default_action = 'thumbnail_image';

// Change this to change the default sort order.  Valid options are 'title_asc',
// 'title_desc', 'orig_time_desc' (origination time, newest first),
// 'orig_time_asc' (origination time, oldest first), 'mtime_desc' (modification
// time, newest first), and 'mtime_asc' (modification time, oldest first).

$g2ic_sortby = 'title_asc';

// EMBEDDED MODE OPERATIONS
// This section applies to embedded mode operations, other than WPG2.
// If you have embedded your Gallery2 in another application (Drupal, Joomla
// etc.), then you'll need to configure the following info to get G2Image to
// create correctly fomatted links for your application.
//
// WPG2 users are already covered by communications between G2Image and
// WPG2, so you do not need to set these parameters.
//
// The key for users of other platforms is to make sure that your settings here
// match the embedded settings in your platform.  This will result in img URLs
// that will work well in your embedded application.

// Set $g2ic_embedded_mode to TRUE to enable embedded mode operations.

$g2ic_embedded_mode = TRUE;

// If your Gallery2 main.php is in a different subdomain than G2Image,
// you must set $g2ic_use_full_path to TRUE, and enter the full directory path
// to Gallery2 in $g2ic_gallery2_path.  However, G2Image by itself
// does not support Gallery2 being in a different subdomain.  You must use
// another program with Gallery2 in embedded mode (like Drupal or Joomla)
// with Gallery2 URL rewrite rules properly configured to redirect the resulting
// link to Gallery2 in the other subdomain.  That is why this setting is located in
// the EMBEDDED MODE OPERATIONS section.
//
// If $g2ic_embedded_mode is set to FALSE, $g2ic_use_full_path must also be
// set to false and the proper path must be entered into $g2ic_gallery2_path.

$g2ic_use_full_path = TRUE;

// $g2ic_gallery2_uri is the URL of your Gallery2 main page.
// For example, if your Gallery2 main page is
// http://www.domain.com/gallery2/main.php
// then
// $g2ic_gallery2_uri = 'http://www.domain.com/gallery2/main.php';

$g2ic_gallery2_uri = 'http://www.hagan-net.net/g2/main.php';

// $g2ic_embed_uri is the URL of your embedded page.
// For example, if your embedded page is
// http://www.domain.com/wordpress/wp-gallery2.php
// then
// $g2ic_embed_uri = 'http://www.domain.com/wordpress/wp-gallery2.php';

$g2ic_embed_uri = 'http://www.hagan-net.net/e107_plugins/gallery2/gallery2.php';

// DRUPAL GALLERY2 FILTER OPERATIONS
// If you are using Drupal and have the Gallery2 Filter module activated, you
// can insert a G2 Filter in the simplest format: [G2:itemid].  If you want to
// make this the default action, set $g2ic_default_action to 'drupal_g2_filter'.
// Set this to TRUE to enable.

$g2ic_drupal_g2_filter = FALSE;

// Set the Drupal G2 Filter prefix here

$g2ic_drupal_g2_filter_prefix = 'G2';

?>
 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Thu, 2007-10-04 17:21

Hmmm. Looks like it should work.

When you open g2image, is it giving you the directory tree and thumbnails? If so, it's talking to Gallery2 correctly.

I made an account, but I can't figure out how to get to a window with g2image on it. Could you upgrade me (capt_kirk) to a posting member. I won't post, but would like to see what it's doing first hand.

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

 
Rash

Joined: 2006-03-04
Posts: 54
Posted: Thu, 2007-10-04 18:32

I've set your account as an admin. right now, I've got it set so that only admin accounts can use TinyMCE. So, you should be all set with that now.

To answer your question: Yes, when I open g2IC it displays the directory and thumbnails.

Feel free to create a new thread in the forums there and post away. :)

Rashan

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Thu, 2007-10-04 20:39

The good news is that I accidentally got g2image to insert images. I wish I could take credit for it, but all I did was look at the admin page for the e107 G2 plugin, and it started working.

It looked like the g2image window didn't know that it was being called by TinyMCE, but then it started working. I hate bugs like that...

The bad news is that the e107 is stripping out the http://www.hagan-net.net/ part of the thumbnail's URL, so it's just showing the alt attribute of the img tag as a text link. When I use Firebug to edit the img tag's src attribute to add a leading slash, it shows the image.

So, the a+img tag as inserted by g2image is

<a href="http://www.hagan-net.net/e107_plugins/gallery2/gallery2.php?g2_itemId=1984">
<img title="Fat kittens need luvin' too." alt="IMG_0124" src="http://www.hagan-net.net/g2/main.php?g2_view=core.DownloadItem&g2_itemId=1985"/>
</a>

e107 is changing it to

<a href="../../e107_plugins/gallery2/gallery2.php?g2_itemId=1984">
<img title="Fat kittens need luvin' too." alt="IMG_0124" src="g2/main.php?g2_view=core.DownloadItem&g2_itemId=1985"/>
</a>

This would work if it had a leading slash in src=, like this

<a href="../../e107_plugins/gallery2/gallery2.php?g2_itemId=1984">
<img title="Fat kittens need luvin' too." alt="IMG_0124" src="/g2/main.php?g2_view=core.DownloadItem&g2_itemId=1985"/>
</a>

Without that slash, it's trying to get the image relative to the page it's on, instead of relative to the server root. The slash is definitely being removed in the TinyMCE editor window. If you click on the Image Properties button or on the HTML view after inserting an image but before saving the thread, you can see it's already been removed there. I don't know if this is an e107 core bug or a TinyMCE bug.

I haven't played with TinyMCE's settings in a long time (over a year - before we went to Africa and came back...) But I think I remember that there is a setting for allowing full URLs instead of forcing server relative URLs. I'd try to find that and set it in your TinyMCE configuration.

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

 
Rash

Joined: 2006-03-04
Posts: 54
Posted: Thu, 2007-10-04 22:39

Thanks Kirk! I'm heading out of town tonight, but I'll check out the TinyMCE issue on Monday and let you know what I can find out

Rashan

 
Rash

Joined: 2006-03-04
Posts: 54
Posted: Mon, 2007-10-08 16:27

That was it Kirk. for e107, these config parameters are stored in the /e107_handlers/tinymce/wysiwyg.php file. Simply change the relative_urls option to FALSE and it's all fixed.

Thanks for your help, and the fantastic program!

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Mon, 2007-10-08 21:06

Thanks. Glad to hear it worked. I'll create an e107 section on the G2Image wiki and ask you to check if I got it right. (Maybe tonight, probably Wednesday...)

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

 
Rash

Joined: 2006-03-04
Posts: 54
Posted: Mon, 2007-10-08 21:18

sounds good. some other information on setting up G2ic for e107 can be found here: http://hagan-net.net/e107_plugins/forum/forum_viewtopic.php?42 <-- that was written for v2.3 of g2ic, but it should still be good for the 3.x series as well.

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Mon, 2007-10-08 21:50

Thanks. I saw that while I was browsing around your site, and was planning to plagiarize heavily. :)

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

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Mon, 2007-10-08 22:37

Here is the new e107 entry in the G2Image wiki. Please double check me.

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

 
Rash

Joined: 2006-03-04
Posts: 54
Posted: Tue, 2007-10-09 13:04

looks great. I think it's all there.

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Tue, 2007-10-09 13:17

Thanks!

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