Include imageblock in sidebar

janbanan

Joined: 2005-09-19
Posts: 30
Posted: Tue, 2008-05-13 11:07

Hi, I'm trying to include an imageblock from gallery2 in my wordpress page but have trouble configuring the permalink settings amongst other things.

Problem: Whether I insert the g2_sidebarimageblock(); option or the g2 image_block code, the relative link from the thumbnail (which on the other hand shows up just fine i wordpress) gets messed up.

Instead of
http://www.mydomain.com/gallery2/main.php/v/Albumname/

the output is:
http://www.mydomain.com/wordpress/v/Albumname/

Is there someway to alter this link setting through wpg2 or elsewhere? Ps I need to have the url rewrite module "on" in gallery2.

Thanks in advance

Login or register to post comments
ozgreg
ozgreg's picture

Joined: 2003-10-18
Posts: 1337
Posted: Tue, 2008-05-13 11:55

WPG2 links will be relative to your blog that is how it is meant to work so that link is perfect.. If you want your links relative to Gallery2, not sure why you would but you can use the Gallery2 ImageBlock to add photos to your sidebar..

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

Login or register to post comments
janbanan

Joined: 2005-09-19
Posts: 30
Posted: Tue, 2008-05-13 12:07

What I want is to include an imageblock in my wordpress page that links to the gallery2 directory - like a random image. I guess what you're saying is that this is not feasible through WPG2. Hence I tried using the ImageBlock code from gallery instead. But if I use the this ImageBlock the link still takes me to the wordpress directory.

The reason for wanting this is quite straight forward - I want to show a random image in wordpress that links to gallery (for further browsing of images).

Attach the ImageBlock code I use - just in case :-)

<?php
 if (!headers_sent()) {
header('Content-Type: text/html; charset=UTF-8');
}
 require_once(dirname(__FILE__) . '/gallery2/embed.php');
 $ret = GalleryEmbed::init(array('fullInit' => true, 'embedUri' => '/gallery2/main.php'));
 if ($ret) {
     print 'GalleryEmbed::init failed, here is the error message: ' . $ret->getAsHtml();
     exit;
 }
 list ($ret, $bodyHtml, $headHtml) = GalleryEmbed::getImageBlock(array('blocks' => 'randomImage',
                                                                 'show' => 'title'));
 if ($ret) {
     print 'GalleryEmbed::getImageBlock failed, here is the error message: ' . $ret->getAsHtml();
     exit;
 }
?>
Login or register to post comments
capt_kirk

Joined: 2006-01-24
Posts: 489
Posted: Tue, 2008-05-13 16:27
janbanan wrote:
What I want is to include an imageblock in my wordpress page that links to the gallery2 directory - like a random image. I guess what you're saying is that this is not feasible through WPG2.

It is possible using WPG2. What Ozgreg was saying is that the two links you posted in your original post are identical because of URL rewrites. The link that has "wordpress" in it shows your Gallery2 page in a WordPress wrapper. The link that has "gallery" in it shows your Gallery2 page in its native mode. BOTH show the same Gallery2 page. And both allow further browsing of images. See my family website for an example (link below).

It looks like your code should work. I'm just guessing, since I haven't actually done the troubleshooting required to prove this, but it's possible that if you still have WPG2 running, the WPG2 embed init overrides this one, since it would have already happened for the page, resulting in the embedded link instead of a native Gallery2 link. Have you tried that code with WPG2 deactivated?

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

Login or register to post comments
ozgreg
ozgreg's picture

Joined: 2003-10-18
Posts: 1337
Posted: Tue, 2008-05-13 22:32

Hiya janbanan,

As has been posted several times we do not support directly linking to Gallery2 which is what you are doing by pointing to the embed.php file due to issues with the correct handling of G2 Sessions (this has been discussed in a number of different threads..)

Quote:
The reason for wanting this is quite straight forward - I want to show a random image in wordpress that links to gallery (for further browsing of images).

FYI Linking to the WPG2 Page has the exact same functionality (without the session issues and the problems with G2 security settings) except as I posted the links will be relative to your blog..

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

Login or register to post comments
janbanan

Joined: 2005-09-19
Posts: 30
Posted: Wed, 2008-05-14 06:29

Wow - thanks for your answers.

Firstly capt_kirk, you were straight on - when I deactivated the WPG2 everything worked like a charm. :-)

Ozgreg - Linking to the WPG2 page, that's exactly what I would like to. However my permalinks settings in gallery get messed up when and if I choose this option - it doesn't seem to be compatible with the ones in WPG2 - but I do have to confess - I haven't yet dug in to that quite much.

Login or register to post comments