joomla - External Image Block

Guy007

Joined: 2005-10-20
Posts: 9
Posted: Sat, 2006-01-28 14:55

I am creating a site using Joomla and G2, and the following is my setup:
www.mysite.org/index.php //main joomla homepage
www.mysite.org/gallery //gallery2 folder

I want to be able to display a random image from the gallery on the index.php page.

So i included the following line in the php code:

<?php @readfile('http://mysite.org/gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=none'); ?>

The random image is now appearing, but when I click on the random image, i am taken to the standalone G2 page, instead of displaying it in a wrapper on index.php.

is there a way how i can change the url to which the random image links?

thanks

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2006-01-28 15:30

topic moved and renamed.

don't use the external imageblock. if the joomla integration has an imageblock, use that.
else, manually use GalleryEmbed::getImageblock(.....);

http://codex.gallery2.org/index.php/Gallery2:GalleryEmbed:getImageBlock

 
Guy007

Joined: 2005-10-20
Posts: 9
Posted: Sat, 2006-01-28 17:36
Quote:
<?php
/* You'll have to change the /gallery2/ thing in the following 2 lines probably */
require_once(dirname(__FILE__) . '/gallery2/embed.php');
$ret = GalleryEmbed::init(array('fullInit' => true, 'embedPath' => '/gallery2/'));
if ($ret->isError()) {
print 'GalleryEmbed::init failed, here is the error message: ' . $ret->getAsHtml();
exit;
}
/*
* See "Site admin" -> "image block" for all available options. the parameters are the same
* as for the external imageblock
*/
list ($ret, $bodyHtml, $headHtml) = GalleryEmbed::getImageBlock(array('blocks' => 'randomImage',
'show' => 'title|date'));
if ($ret->isError()) {
print 'GalleryEmbed::getImageBlock failed, here is the error message: ' . $ret->getAsHtml();
exit;
}
/* $bodyHtml contains the image block. print it somewhere on your website */
print $bodyHtml;
/*
* $headHtml is not required. if you use imageframes for your imageblocks, you need to print
* $headHtml in the <head> section of your web page
*/
?>

Sorry, but I'm still new to this stuff!

I placed this code in my index.php. The random image gets displayed, but the problem still remains. But when i click on the image, it still links to the standalone G2 album...

Joomla's random image block can only extract images from one particular folder (not sub folders), so its not good for what i want it...

 
dotnature
dotnature's picture

Joined: 2005-10-26
Posts: 224
Posted: Sat, 2006-01-28 18:02

You dont need any code for this to work have you installed the right random image block from http://opensource.4theweb.nl/

Heres a direct link to the module that you need to use
http://developer.joomla.org/sf/frs/do/viewRelease/projects.gallery2_bridge/frs.modules.image_module;jsessionid=94626708F1415DE20F0CD493EB9A0100