Share / post pics on Facebook

ron@adobewerks.com
ron@adobewerks.com's picture

Joined: 2006-11-09
Posts: 66
Posted: Fri, 2008-11-07 22:28

I dont know if this module exists or not. But, you know how some sights have little icons that allow you to post the article, video or picture on your Facebook/Myspace or other social networks? (see attached images). Is there a feature/ module out there already for this? It seems so prevalent in other CMS's.. thought it must be. thanks in advance!

www.adobewerks.com

AttachmentSize
gallery-shareforum01.jpg15.04 KB
gallery-shareforum02.jpg2.75 KB
 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Fri, 2008-11-07 22:41

Seems like it would be pretty trivial to add that to your own theme:
http://sharethis.com/
http://www.addthis.com/
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
ron@adobewerks.com
ron@adobewerks.com's picture

Joined: 2006-11-09
Posts: 66
Posted: Fri, 2008-11-07 22:51

any guidance on where to put the code? I got the code from addthis.com i have made some minor mods to my theme, but would need a "leg up" to get this one done

 
ron@adobewerks.com
ron@adobewerks.com's picture

Joined: 2006-11-09
Posts: 66
Posted: Fri, 2008-11-07 23:08

Well.. i actually figured it out. for future generations, here is what i did:

I modified photo.tpl

i pasted the code I got from addthis.com right after this code:

{* Download link for item in original format *}
{if !empty($theme.sourceImage) && $theme.sourceImage.mimeType != $theme.item.mimeType}
<div class="gbBlock">
<a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.item.id`"}">
{g->text text="Download %s in original format" arg1=$theme.sourceImage.itemTypeName.1}
</a>
</div>
{/if}

Bam! works like a charm. Thanks!!

www.adobewerks.com

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Fri, 2008-11-07 23:12

Depends on where you want it. On every page edit theme.tpl, on the album pages only, album.tpl, on the photos pages only, photo.tpl

Read this about editing templates:
http://codex.gallery2.org/Gallery2:Editing_Templates

The files to edit are currently in /themes/<YourTheme>/templates
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
pavel.pola

Joined: 2007-05-19
Posts: 30
Posted: Sat, 2009-01-17 12:03

I have finished the Facebook "share it" button. It is quite easy but requires a few modifications in templates. I have made two changes - at first, I have prepared image button to the main toolbar and second - I have put the link to the footer of every page.

0. Common changes
=================
- prepare small JavaScript file for executing Facebook scripts (I have it in themes/carbon/facebook.js)

function fbs_click() {
u=location.href;
t=document.title;
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
return false;
}

- add link to this script to HEAD section in theme.tpl

{if $theme.pageType != 'admin'}
<script type="text/javascript" src="{g->url href='themes/carbon/theme.js'}"></script>
<script type="text/javascript" src="{g->url href='themes/carbon/facebook.js'}"></script>
{/if}

- prepare CSS file for style used with Facebook buttons (I have put it in themes/carbon/facebook.css):

# this is for link in footer
html .fb_share_link {
padding:2px 0 0 20px;
height:16px;
background:url(http://b.static.ak.fbcdn.net/images/share/facebook_share_icon.gif?7:26981) no-repeat top left;
font-family:"lucida grande",tahoma,verdana,arial,sans-serif;
font-size:11px;
}

# this is for image button in toolbar
.buttonFacebook a {
display: block;
width: 133px;
height: 15px;
background: url('../carbon/images/facebook.gif') no-repeat;
}
.buttonFacebook a:hover { background-position: -133px 0; }

- alter theme.tpl to include this stylesheet:

{* Include this theme's style sheet *}
<link rel="stylesheet" type="text/css" href="{g->theme url="theme.css"}"/>
<link rel="stylesheet" type="text/css" href="{g->theme url="facebook.css"}"/>

1. Image button
===============
- prepare an image button (GIF) you want to put in the toolbar (I'm using two state button with mouse hover highlight)
- upload it to your theme/images (I have it in themes/carbon/images)
- make changes in album.tpl / photo.tpl - to add this button. Find a "gsActionIcon" buttons and put it where you want it

<td class="gsActionIcon">
<div class="buttonFacebook"><a href="http://www.facebook.com/share.php?u={g->url params=$theme.pageUrl forceFullUrl=true forceDirect=true}" onclick="return fbs_click()" target="_blank"></a></div>
</td>

2. Footer link
==============
- make a change in theme.tpl (find a section where logo buttons are located) and add

<td align="center" width="10%">
<a href="http://www.facebook.com/share.php?u={g->url params=$theme.pageUrl forceFullUrl=true forceDirect=true}" onclick="return fbs_click()" target="_blank" class="fb_share_link">Share on Facebook</a>
</td>

More info: http://www.facebook.com/share_partners.php
_________________________________
Please visit my personal gallery: http://www.pavelpola.cz (mostly B&W pictures, Prague, nature, people)

 
wordmaverick

Joined: 2009-06-02
Posts: 1
Posted: Tue, 2009-06-02 17:21

pavel.pola - If I understand your instructions properly you are sending a gallery album page link to Facebook. Is it possible to post the image (and only the image) to Facebook?

 
pavel.pola

Joined: 2007-05-19
Posts: 30
Posted: Wed, 2009-06-10 05:34

Hello, this feature is provided only for sharing links to pages (it doesn't matter if you share a link to album or photo page). If you want your images uploaded directly to Facebook, you should use their API: http://wiki.developers.facebook.com/index.php/Photo_uploads. I don't want to share my images in that way - I don't like their Terms & Conditions and I want to have all my images only in one place.
_________________________________
Please visit my personal gallery: http://www.pavelpola.cz (mostly B&W pictures, Prague, nature, people)

 
tuckbooty

Joined: 2009-08-18
Posts: 2
Posted: Tue, 2009-08-18 23:19

I was wondering the same thing, I came across this one site whereas the user has been able to create a link that shares individual photos on Facebook via a link, he also has it sharing his entire gallery if need be. And for the life of me I cannot locate module to do the same. Below is a link to the site I was referring to:

http://www.jasenhudson.com/event-photos/?g2_itemId=80397

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2009-08-19 04:13

not tested but in photo.tpl of the theme you are using add this:
<a href="http://www.facebook.com/share.php?u={$smarty.server.PHP_SELF}" alt="Add to facebook"><img src="http://b.static.ak.fbcdn.net/images/share/facebook_share_icon.gif?8:26981"> Share on Facebook</a>

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
tuckbooty

Joined: 2009-08-18
Posts: 2
Posted: Wed, 2009-08-19 22:12

Thanks Floridave, I'll give that a whril.

 
ccsnet

Joined: 2009-10-03
Posts: 16
Posted: Tue, 2009-11-10 09:53

Hi... just thought I would say I'm a first time gallery user and decided that I'd go with the beta rather than the live to save the upgrade pain seeing as I was starting from fresh. Using one of the basic templates I have found it works pretty well although I have experienced the moving album issue under some browsers as already reported. I was wondering if the team had a time scale for realease at all.... not that I am pushing.... more interested in when the api side will be done so I can start using some of the apps and tools about to integrate with my web sites.

Any way keep up the good work and thanks....

Terran