| Author |
Message |
WizardOfZo
 Guru


Joined: Sep 24, 2008 Posts: 55
|
Posted: Sun Sep 28, 2008 6:40 am Post subject: Gallery2 Random Photo Block in Portal |
|
|
I looked for a simple way to display random photos on the Board3 Portal from Gallery2
I am using Board3 Portal 1.01. (http://www.board3.de/portal.php) I have phpBB3 3.02 with Gallery2 2.26 and I installed the latest gallery2-phpBB3 integration.
In my setup I have Gallery2 Image Block 1.1.0 installed and activated but until now, I have not found an easy way to display random images outside the gallery.
I am not a fancy programmer, so this is a little crude.
I hope someone can do it properly and maybe add a few "bells & whistles" to make it more appealing.
Here is my method:
In \phpBB3\styles\prosilver\template\portal\block\:
I took the custom_small.html and did some editing:
Between...
Code: › <div class="content">
{PORTAL_CUSTOM_SMALL_CODE}
and.....
Code: › </div>
I added....
Code: › <object data="http://my-website/my-phpBB3-home/gallery2.php?g2_view=imageblock.External&g2_show=none&g2_maxSize=200&g2_linkTarget=_blank" type="text/html" width="180" height= "180">
</object>
Then I edited the title of the Small Custom block in ACP .MODS to read "Photo Gallery"
leaving the code are blank.
That is all.
Problems you may run into are thumbnails that are too large, then you will get scroll bars. You may have to play with the maxSize and/or the object sizes.
If someone has done this or something better, please let me know. For now, it works OK for me |
|
| Back to top |
|
|
AdBot
|
| Post subject: Gallery2 Random Photo Block in Portal |
|
|
|
|
|
| Back to top |
|
 |
jettyrat
Moderator


Joined: Nov 28, 2005 Posts: 1144
|
Posted: Sun Sep 28, 2008 9:07 pm Post subject: Re: Gallery2 Random Photo Block in Portal |
|
|
Have a link?
I've been playing around with Board3 portal and have a full-blown custom block written for it that displays random images from the imageblock. http://jettyfishing.com |
|
| Back to top |
|
|
WizardOfZo
 Guru


Joined: Sep 24, 2008 Posts: 55
|
Posted: Mon Sep 29, 2008 5:41 am Post subject: Re: Gallery2 Random Photo Block in Portal |
|
|
jettyrat wrote: › Have a link?
I've been playing around with Board3 portal and have a full-blown custom block written for it that displays random images from the imageblock. http://jettyfishing.com
Sorry no public link to mine (yet) Still a lot of work to do.
Yours looks good, I was thinking of doing more than one image but I have a very low power server (runs on 5 watts) and I don't want to push it to much yet.
Please let me know if you plan on making your block code public.
Thnaks |
|
| Back to top |
|
|
jettyrat
Moderator


Joined: Nov 28, 2005 Posts: 1144
|
Posted: Mon Sep 29, 2008 9:07 am Post subject: Re: Gallery2 Random Photo Block in Portal |
|
|
It's basically using the same code that I've posted 2 or 3 times here already. I can make it public when G2.3 is final as that is what it is written for at the moment. The next release of the integration code will have a function already included in g2helper to call for using the embedded imageblock on pages. Anyone can use it by setting a template var and adding the variable to a template where you want the images to show...it'll be that simple.  |
|
| Back to top |
|
|
2KLiX
Beginner


Joined: Aug 03, 2008 Posts: 9
|
Posted: Tue Sep 30, 2008 12:14 pm Post subject: Re: Gallery2 Random Photo Block in Portal |
|
|
Hi Wizard ofZo, I guess this is the type of thing you are talking about? http://cameralost.com/forum [cameralost.com]
I will post a solution as soon as I have eaten
OK, I have eaten and am back to edit my post,
The way I did it on my phpbb3 board was to add the code below to the forum_directory/styles/Glacier-Lite/template/index_body.html file
Code: › <div class=images><!-- PHP -->
require_once('/home/user/public_html/gallery2/embed.php');
$ret = GalleryEmbed::init(array('fullInit' => true, 'embedUri' => '/forum/gallery2.php', 'g2Uri' => 'http://www.yoursite.com/gallery2/main.php'));
if ($ret) {
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' => 'recentImage|recentImage|recentImage|recentImage',
'show' => 'title|date'));
if ($ret) {
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
*/
<!-- ENDPHP --></div>
And then I added this to the forum_directory/styles/Glacier-Lite/theme/common.css file
Code: › .images .one-image{float:left;padding-left:57px;}
h3 {clear:both}
I hope this helps a little and you can put it to some use.
Cheers
Matt |
|
| Back to top |
|
|
WizardOfZo
 Guru


Joined: Sep 24, 2008 Posts: 55
|
Posted: Tue Oct 07, 2008 3:40 am Post subject: Re: Gallery2 Random Photo Block in Portal |
|
|
Thanks for the code. it looks great on your site.
Not sure if it will work for me in Prosilver.
I think a short wait for Gallery 2.3 and the new integration package will be my best bet for random images. |
|
| Back to top |
|
|
2KLiX
Beginner


Joined: Aug 03, 2008 Posts: 9
|
Posted: Tue Oct 07, 2008 6:00 am Post subject: Re: Gallery2 Random Photo Block in Portal |
|
|
I'm pleased I could be of assistance
Good luck with the site! |
|
| Back to top |
|
|
GENCarter
Novice


Joined: Oct 08, 2008 Posts: 26
|
Posted: Tue Oct 14, 2008 8:33 am Post subject: Re: Gallery2 Random Photo Block in Portal |
|
|
I don't want to have php-code in my templatefiles.
Can someone code an alternative method to display a randompicture-block for a portal, not board3, but vinabb.com! |
|
| Back to top |
|
|
jettyrat
Moderator


Joined: Nov 28, 2005 Posts: 1144
|
Posted: Tue Oct 14, 2008 9:17 am Post subject: Re: Gallery2 Random Photo Block in Portal |
|
|
If you are using the new integration version, use the included fetchImageBlock function in g2helper.
If using an older integration, use something similar to this-Code: › Open styles/prosilver/overall_header.html
Find:
<!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN and (U_MCP or U_ACP) -->
<div id="message" class="rules">
<div class="inner"><span class="corners-top"><span></span></span>
<strong>{L_INFORMATION}:</strong> {L_BOARD_DISABLED}
<span class="corners-bottom"><span></span></span></div>
</div>
<!-- ENDIF -->
Replace With:
<!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN and (U_MCP or U_ACP) -->
<div id="message" class="rules">
<div class="inner"><span class="corners-top"><span></span></span>
<strong>{L_INFORMATION}:</strong> {L_BOARD_DISABLED}
<span class="corners-bottom"><span></span></span></div>
</div>
<!-- ELSEIF not S_GALLERY2 -->
<div class="navbar">
<div class="inner"><span class="corners-top"><span></span></span>
<div style="text-align: center;">{G2_IMAGES}</div>
<span class="corners-bottom"><span></span></span></div>
</div>
<!-- ENDIF -->
Open includes/functions.php
Find:
// The following assigns all _common_ variables that may be used at any point in a template.
$template->assign_vars(array(
'SITENAME' => $config['sitename'],
Replace With:
if (!empty($config['g2i_fullPath']) && !empty($config['g2i_embedUri']) && !empty($config['g2i_g2Uri']) && !empty($config['g2i_activeAdminId']))
{
require_once($phpbb_root_path . 'g2helper.' . $phpEx);
$g2h = new g2helper();
$g2_images = trim(str_replace(array('<div class="one-image">', '</div>'), array('', ''), $g2h->fetchImageBlock($user)));
}
else
{
$g2_images = $user->lang['OBTAIN_SETTINGS_FAILED'];
}
// The following assigns all _common_ variables that may be used at any point in a template.
$template->assign_vars(array(
'G2_IMAGES' => $g2_images,
'SITENAME' => $config['sitename'],
Open g2helper.php
Find:
}
?>
Before, Add:
function fetchImageBlock($user)
{
$this->init($user);
list ($ret, $g2_images) = GalleryEmbed::getImageBlock(array('blocks' => 'randomImage|randomImage|randomImage|randomImage', 'show' => 'none'));
if (isset($ret))
{
trigger_error('getImageBlock error' . $user->lang['G2_ERROR'] . $ret->getAsHtml(), E_USER_ERROR);
}
$this->done();
return $g2_images;
} |
|
| Back to top |
|
|
2KLiX
Beginner


Joined: Aug 03, 2008 Posts: 9
|
Posted: Tue Oct 14, 2008 10:29 am Post subject: Re: Gallery2 Random Photo Block in Portal |
|
|
This is a great solution Jettyrat, I have edited my template and it looks great. You can see the changes at
Camerafound.com [cameralost.com]
Thanks |
|
| Back to top |
|
|
jettyrat
Moderator


Joined: Nov 28, 2005 Posts: 1144
|
Posted: Tue Oct 14, 2008 12:36 pm Post subject: Re: Gallery2 Random Photo Block in Portal |
|
|
| Cool. It's a basic implementation. You can jazz it up more with a title and link to the gallery or whatever... |
|
| Back to top |
|
|
2KLiX
Beginner


Joined: Aug 03, 2008 Posts: 9
|
Posted: Wed Oct 15, 2008 10:56 am Post subject: Re: Gallery2 Random Photo Block in Portal |
|
|
jettyrat wrote: › You can jazz it up more with a title and link to the gallery or whatever...
I have just added a date to the photos and I'm getting the images displayed one below the other because there is a paragraph and span used for the date.
Can you tell me whether there is an easy way to get the images to display side by side.
My guess is with CSS but I'm not sure how but maybe you know another solution. |
|
| Back to top |
|
|
jettyrat
Moderator


Joined: Nov 28, 2005 Posts: 1144
|
Posted: Wed Oct 15, 2008 11:09 am Post subject: Re: Gallery2 Random Photo Block in Portal |
|
|
| Try changing this line in my mod: Code: › $g2_images = trim(str_replace(array('<div class="one-image">', '</div>'), array('', ''), $g2h->fetchImageBlock($user)));
To this:Code: › $g2_images = $g2h->fetchImageBlock($user);
And use the css that is mentioned on the gallery page for the imageblock. (I think you had the css this way before.) |
|
| Back to top |
|
|
2KLiX
Beginner


Joined: Aug 03, 2008 Posts: 9
|
Posted: Wed Oct 15, 2008 11:25 am Post subject: Re: Gallery2 Random Photo Block in Portal |
|
|
jettyrat wrote: › And use the css that is mentioned on the gallery page for the imageblock.
Do you have a link to that page? |
|
| Back to top |
|
|
jettyrat
Moderator


Joined: Nov 28, 2005 Posts: 1144
|
|
| Back to top |
|
|
|
|
|
|
|