G2.1 and ImageBlock embedding
|Posted: Thu, 2006-03-30 23:32|
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?