News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Picasa Gallery Browser

Started by PJLawrence, December 10, 2008, 01:58:02 PM

Previous topic - Next topic

PJLawrence

Link to Mod

*******************************
Picasa Gallery Browser Mod
*******************************

This mod allows you to browse the public albums of a Picasa Gallery account as part of your SMF forum.

Once installed this mod places a Picasa Gallery menu item on the default forum theme.
Before you can view your selected Picasa Album you need to go the Picasa Galley Browser admin settings which can be found...
In SMF  1.1 admin options are found in the Features and Settings admin page under "Layout and Options".
In SMF 2.0 admin options are found under Miscellaneous in Configuration, Modifications of your admin panel.

Set the server to your Picasa server i.e. http://picasaweb.google.com and user name to your Picasaweb user name. Make sure that there is no spaces after the username or server address when entering them into the relevant text boxes.

Admin options include...
1) The ability to restrict this gallery browser to display just one selected album.
2) An optional default Album. Leave blank if you wish, by default, to list the public albums.
3) Set the number of images to display per a row.

For more information about Picasa, check out picasaweb.google.com.

Disclaimer: This mod is provided "as is" without express or implied warranty.

Credits...

  • This mod uses the Highslide JS view. The Highslide JS is licensed under a Creative Commons Attribution-NonCommercial 2.5 License. This means you need the author's permission to use Highslide JS on commercial websites. http://highslide.com/#licence
  • The Snoopy PHP net client is distributed under the GNU Lesser General Public license. http://snoopy.sourceforge.net/
  • The MagpieRSS, a simple RSS integration tool,  is distributed under the GNU Lesser General Public license. http://magpierss.sourceforge.net/
  • Picasa is a trademark of Google Inc. This product uses the Picasa Web Album API but is not endorsed or certified by Picasa.

The Picasa Gallery Browser should work with any theme.
However, if you're not using the default theme under SMF1 you may need to add a 'Picasa Gallery' button, index.php?action=picasagallerybrowser, to your theme.

Changelog...
   0.1 - November  2008 (First release)
   0.2 - 08th November  2008
  • Major rework of template and picasagallerybrowser.php files to make them more consistent with SMF guide lines.
  • The introduction of a separate css file for highslide settings.
  • Modifications to SMF2 install php script to use $smcFunc['db_insert'].
   0.3 - 10th November, 2008
   0.4 - 1st December, 2008
  • Removed some hard coded strings from picasagallerybrowser.template.php

SMF Versions: 1.1.6, 1.1.7 and 2.0 Beta 4

Sabre™

Beautiful mod mate!

Is there anyway to display only one album in the picasso users collection?
Meaning I have a martial arts album I would like to display, but by only being directed by my userID it also displays my family and holiday albums etc..
Do you think this would be able to be implemented?

Cheers mate, and congrats on another good mod :)
Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


PJLawrence

Yes. Simply go to the gallery's admin options and enter the album name that you wish to display as the default album. Then check the Default Picasa Album Only option.

Sabre™

#3
Arrrrggg

Sorry mate, I tried that and couldnt get it to show.
It was then that I woke up and realised that I should be copying the albums browser name, instead of the written text.

eg. Autumn 2007 - Autumn 2008
is Autumn2007Autumn2008

Cheers buddy :)

EDIT
Is it possible to add tag searches?
Meaning each image tagged "martial" in all my folders would be displayed.
I ask this as I would like to use a martialschools images, but only those tagged martial.
If it isnt possible at the moment, do you see it being made so in another release?

Also Ive been trying to get the dimming effect darker, to no eval.
Is there more than one setting that needs to be altered for this?

Thank you
Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


PJLawrence

Sorry tags are not available in the current version.
However, I'll keep it in mind for a future update.

Sabre™

Sorry mate, my edit just missed your reply.
It is regards to the dimming effect, how would we make it appear darker?
I changed the value of "dimmingOpacity" many times, but no change occured.
What am I missing?
Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


PJLawrence

The documentation relating to the java script settings can be found on the highslide website.
The opacity option info can be found here..
http://highslide.com/ref/hs.dimmingOpacity

Sabre™

What is linking to that gonna do?
I mentioned I was changing the variables for it, which indicates I know what to look at. Nothing else is needed but to change the value.
All that needed mentioning was which template to edit, as it is mentioned in a few.

Anyways, I was looking at the wrong templates and js lol.
For anyone that wants to alter it, look for  "hs.dimmingOpacity"  in the  picasagallerybrowser.template

Changing
hs.dimmingOpacity = 0.1;

to
hs.dimmingOpacity = 0.75;
Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


PJLawrence

Sorry about that Sabre, I thought you were enquiring about what values it takes not its location within he code.

Regarding the tag thing, you can make a manual edit to the picasagallerybrowser.php, found in the smf source folder to include the tag value.

Look for the lines...

function getPicasaPhotos($baseurl, $user, $album, $access = 'public') {
$feedURL = $baseurl.'/data/feed/api/user/'.$user.'/album/'.$album.'?kind=photo&alt=rss';


and add to the $feedURL string a tag value &tag=WHAT_TO_SEARCH_FOR

Hence if I wanted all photos with the martial tag the code would look like this..


$feedURL = $baseurl.'/data/feed/api/user/'.$user.'/album/'.$album.'?kind=photo&alt=rss&tag=martial';


b4pjoe

Is there a way to make this gallery so only logged in members can see it?

PJLawrence

Sorry no. I was kind of thinking that if the photos are public on Picasa then there was no point in restricting them in this mod.
The only method currently of stopping guests from browsing the gallery is the lock your forum down by not allowing guests to browse the forum.

If you know a bit of PHP you can edit your theme so that it only displays the gallery button to a person who has logged in by adding if (!$context['user']['is_guest']) above the gallery button code. Then add a similar check in the picasagallerybrowser.php file found in the source folder.

b4pjoe

Just an FYI what I did so only logged in members can see the Picasa Gallery menu item. In Subs.php I changed:

'picasagallerybrowser' => array(
'title' => $txt['picasa_gallery'],
'href' => $scripturl . '?action=picasagallerybrowser',
'show' => true,
'sub_buttons' => array(
),
),


To this:

'picasagallerybrowser' => array(
'title' => $txt['picasa_gallery'],
'href' => $scripturl . '?action=picasagallerybrowser',
'show' => !$user_info['is_guest'],
'sub_buttons' => array(
),
),


Guests no longer can see the menu item for the Picasa Gallery.

PJLawrence

Joec88, Thanks for the code and feedback.
I just want to add, for the other users of this forum, that the above code is for SMF2.
For SMF1 you need to check$context['user']['is_guest'] status and edit your theme template accordingly.
Joec88 are you using SMF 2.0 RC1 or Beta 2?

b4pjoe


yura_mdj

hello.

help please add a button under the theme Babilon, smf ver 1.1.8

it's

// the [picasagallerybrowser] button
echo '
<a href="', $scripturl, '?action=picasagallerybrowser">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/picasagallery.gif" alt="' . $txt['picasa_gallery'] . '" style="margin: 2px 0;" border="0" />' : $txt['picasa_gallery']  , '</a>',' $context['menu_separator'];


here

// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo '
<a href="', $scripturl, '?action=admin">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin.gif" alt="' . $txt[2] . '" style="margin: 2px 0;" border="0" />' : $txt[2]), '</a>', $context['menu_separator'];

// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo '
<a href="', $scripturl, '?action=profile">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/profile.gif" alt="' . $txt[79] . '" style="margin: 2px 0;" border="0" />' : $txt[467]), '</a>', $context['menu_separator'];

// The [calendar]!
if ($context['allow_calendar'])
echo '
<a href="', $scripturl, '?action=calendar">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" style="margin: 2px 0;" border="0" />' : $txt['calendar24']), '</a>', $context['menu_separator'];


What is lacking?

PJLawrence

tura_mdj,

I assume you just want to add a button to your current theme in version 1.1.8
Most themes use their own code for button menu control and display, so its most likely that you will have to copy one of the buttons in the 'template_menu' function and alter it so that it has the correct information. 
A possible solution  is to copy the 'Help' button, make a copy of the code for that button above the original code, and perform the changes below for the new code.

Find this code:

$txt[103]


Replace with this code:

$txt['picasa_gallery']


Find this code:

href="', $scripturl, '?action=help"


Replace with this code:

href="', $scripturl, '?action=picasagallerybrowser"


Find this code (It may occur more than once, or not at all):

$current_action=='help'


If you found it then replace it with this code:

$current_action=='picasagallerybrowser'


If your help button looked something like this:

   // Show the [help] button.
   echo ($current_action == 'help' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
            <td valign="top" class="maintab_' , $current_action == 'help' ? 'active_back' : 'back' , '">
               <a href="', $scripturl, '?action=help">' , $txt[119] , '</a>
            </td>' , $current_action == 'help' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

Then you final forum button should look something like this:

    // Show the [help] button.
   echo ($current_action == 'help' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
            <td valign="top" class="maintab_' , $current_action == 'help' ? 'active_back' : 'back' , '">
               <a href="', $scripturl, '?action=picasagallerybrowser">' , $txt['picasa_gallery'] , '</a>
            </td>' , $current_action == 'picasagallerybrowser' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


Adding the 'picasagallerybrowser' action:
These edits will be required for custom themes that use slightly different code or css for buttons that are currently active. If your theme doesn't do that, then you can ignore these edits.

Find this code:

      $current_action = 'search';


Replace with this code:

      $current_action = 'search';
      $current_action = 'picasagallerybrowser';

Find this code:

, 'login', 'help', 'pm'

Replace with this code:

, 'login', 'help', 'pm', 'picasagallerybrowser'

yura_mdj

2 PJLawrence:

hello, $txt[103] - This variable button "home", I do not want her to remove.

I would add to existing, this is real?

archive files theme.

PJLawrence

Yes you should make a copy of your original theme code before editing it.
You should not change the code of any existing buttons. Only modify the new code you insert into your theme. The instruction relate to copying the code of an another button in the theme and then modifying this copied code to become the button for the Picasa gallery.

yura_mdj


topmmc

I have been trying to get this to work (great app), I have put in my (what I think is my ID) in the "Enter Picasa Account ID" and I have the Picsa public gallery setup and my URL is correct, but I still don't get the gallery in SMF.  What am I doing wrong.

public gallery (just one photo now):  http://picasaweb.google.com/PSMVCC [nofollow]
Top
Marines M/C

Advertisement: