G2.1 and ImageBlock embedding
|
zeguigui
Joined: 2006-01-31
Posts: 4 |
Posted: Thu, 2006-03-30 23:32
|
|
Hello, I just migrated to G2.1 from G2.0... to discover that embedding changed a little. Only 3 parameters, great! I use embedding to display a random image on my blog main page : My Gallery is there: I use URL Rewriting (apache mod_rewrite). The code I use to display a random block :
<?php
require_once("../gallery2/embed.php");
$ret = GalleryEmbed::init(
array( 'embedUri' => '../photos/index.php',
'g2Uri' => '/photos/',
'fullInit' => 'true'));
list ($ret, $imageBlockHtml) = GalleryEmbed::getImageBlock( array(
'blocks' => 'randomImage',
'show' => 'title',
'maxSize' => 170));
echo $imageBlockHtml;
GalleryEmbed::done();
?>
With this code it's almost correct. There is also a problem with the generated link... it links to "v/%path%" whereas it should link to "/photos/v/%path%" (prefixed with website URL if necessary). I did not have this problem with G2.0 with this init :
$ret = GalleryEmbed::init(
array(
'embedUri' => 'index.php',
'fullInit' => 'true',
'embedPath' => '/photos',
'relativeG2Path' => '../gallery2',
'loginRedirect' => '',
'activeUserId' => ''));
Any hint on how I can have both link and img src correct? Thanks |
|

Posts: 4
OK... found the solution!
Should have read the documentation a little bit deeper and the new integration notes
http://codex.gallery2.org/index.php/Gallery2:Integration_Howto#New_.28Gallery_2.1.29_Specs_for_GalleryEmbed::init.28.29
Solution is to remove embedUri:
Note: as there is no static content I can also remove g2Uri