Module: Facebook like module

Pintac
Pintac's picture

Joined: 2009-02-03
Posts: 11
Posted: Wed, 2011-03-09 15:34

In regards to the popup box that I was mentioning, I tried the way the Like works on different software and there is a popup box after you click like.

[img]http://gallery.menalto.com/files/ScreenShot001_2.jpg[/img]

Instead, the Like here posts straight to your wall but isn't visible to anyone's news feed unless you share it. They'll only see it if they look at your profile.

 
kristfin

Joined: 2010-12-02
Posts: 11
Posted: Wed, 2011-03-09 16:11

i just installed the facebook_like_0 version and it works fine. it would be grand to be able to add comment while posting

 
kristfin

Joined: 2010-12-02
Posts: 11
Posted: Wed, 2011-03-09 16:38

i was to happy to fast. the thumbnail does not appear every time on facebook, and whats worse is that i don't see any system in it.

 
Pintac
Pintac's picture

Joined: 2009-02-03
Posts: 11
Posted: Wed, 2011-03-09 16:48
kristfin wrote:
i was to happy to fast. the thumbnail does not appear every time on facebook, and whats worse is that i don't see any system in it.

Did you use the version from this link or the version from the very first post? If you used from the first post, try this one.
http://gallery.menalto.com/node/98752#comment-370082

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Wed, 2011-03-09 17:14

@pintac: Ok, now I see. Looks like you did both. Guessing that you replaced the module, but you also manually added <meta property="og:image" content="LINK-TO-ITEM/ALBUM-THUMBNAIL"/> to the page.php.html file. You can delete the line that you manually added; you only need the line created by the module.

 
Pintac
Pintac's picture

Joined: 2009-02-03
Posts: 11
Posted: Wed, 2011-03-09 17:16

Yeah, thanks for reminding me. Meant to remove that

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Wed, 2011-03-09 17:19
kristfin wrote:
it would be grand to be able to add comment while posting

This is a Facebook thing; "liking" an external item/page doesn't work that way. You may be looking to "Share" an item instead.
http://codex.gallery2.org/Gallery3:Modules:share_bookmark
http://codex.gallery2.org/Gallery3:Modules:sharephoto
http://codex.gallery2.org/Gallery3:Modules:addthis
http://codex.gallery2.org/Category:Gallery_3:Modules

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Wed, 2011-03-09 23:19

Can I ask two related questions?

1. I have been doing some tests of the speed of my gallery, as part of a move from shared hosting to a VPS. I have done some rough tests of the impact of various plugins on speed (moving from one resize image to the next). The ones that caused me greatest concern were the like and share (addthis) modules. Has anyone else found this?

2. Because of the difference between like and share I wanted to have both enabled, but I have found the combination creates too much of performance hit. This creates a dilemma. If I enable one, which one? I prefer Dave's facebook like module because it is more obvious than addthis and more likely to be used. But I would like users to be able to share, and add a comment. Is there any way that Dave's module could have share capability added, perhaps as an option? (I confess I don't fully understand all this Facebook technology.)

U-G

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2011-03-10 02:57

@undagiga: I think there could be some performance improvements. Some (most?) would be out of our/my control. External scripts, for example, we have no control over. Both these modules have external JS code.

A few improvements that comes to mind are:
Minimize the code size. I can't see this being a big improvement.
Make sure that the code (css and non external JS) are combined with other module/theme code.
Give fixed sizes of the <divs> that the external code writes to, this will improve browser rendering.
Now the big one: Get feedback on where performance improvements can be made. Is it the rendering of the page that is slow or some-other factor?

@kristfin: I'm working on the view of the link/button to only albums/items that have guest visibility.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Thu, 2011-03-10 03:35
floridave wrote:
Now the big one: Get feedback on where performance improvements can be made. Is it the rendering of the page that is slow or some-other factor?

I would have said rendering of the page. That is, moving from one resize page to the next, it's slower to render the page. It takes more time for the page to appear. (I am using Greydragon, so the next resize image is preloaded, and when the page appears it does so with the resize image already there, rather than in the process of loading.) I used both a stop-watch and YSlow to measure the load time. Of course the time varies somewhat, so these were averages. How would I know if it is some other factor?

Is it possible to add a share option to your module? I'd like to stick with yours, as I think that addthis is the slower of the two.

U-G

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2011-03-10 03:37

@Pintac, regarding adding a comment;
Only the Open Graph Tags / XFBML version has this option. It requires a FB admin ID or a Facebook Platform application ID. I would think that adding more steps to the module setup/administration would not be worth the hassle. Five steps to get a ID ( http://www.ehow.com/how_5753004_facebook-id.html )

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2011-03-10 04:26

Regarding speed: http://tools.pingdom.com .... over 30 different HTTP requests to render a button? Are they kidding? I can't fix that.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Thu, 2011-03-10 13:56

On the speed issue: I have the facebook and twitter like buttons on a few pages (non-gallery pages, so not using the module) and they consistently load slowly and are always the cause of the page stalling.

Echo @floridave:

floridave wrote:
External scripts, for example, we have no control over. Both these modules have external JS code.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Thu, 2011-03-10 15:07

Try making sure that the JS is loaded from the bottom of the page so it's one of the last things loaded. Also my favorite "hack" for that sort of stuff, like Google's Analytics which does the same thing, even with the asyncronus loading... I have a shell script run via a cron job that goes out and grabs via wget that external JS and buttons a few times a day (actually once every 15 minutes now that I'm on my own VPS) and I load it locally.

I do that with the Facebook buttons, Yelp buttons, Google Analytics, reCAPTCHA and a few other things. Even though page loading tools such as Yslow and Page Speed complain that such content should be on a CDN, my pages load faster than if that content was on a CDN.
____________________________________________
Like Gallery? Like the support? Donate now!

 
Astor

Joined: 2005-12-15
Posts: 154
Posted: Thu, 2011-03-10 16:21
floridave wrote:
Only the Open Graph Tags / XFBML version has this option. It requires a FB admin ID or a Facebook Platform application ID. I would think that adding more steps to the module setup/administration would not be worth the hassle.

I want to add other meta. In the example below code with calls for wordpress

Quote:
<!-- Start Facebook Opengraph -->
<meta property="fb:admins" content="< my admin id>"/>
<meta property="fb:app_id" content="<my app id>" />
<meta property="og:type" content="<post type>"/>
<meta property="og:title" content="<post title>"/>
<meta property="og:site_name" content="<blog title>"/>
<meta property="og:description" content="<post description>"/>
<meta property="og:url" content="<permalink>"/>
<!-- End Facebook Opengraph -->

Can you help to write the bold calls for G3? The other meta (admin id, app id ...) can write me manually

Excuse poor english

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Thu, 2011-03-10 23:12

Has anyone actually compared the speed of loading of the iframe and XFBML versions? Might be worth considering.

U-G

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2011-03-11 00:33

I think the XFBML sitll requires the <iframe>. From what I can discern is the JS looks for the <meta ..og: > tags.
when I sort out the code for only showing the button to guest viewable items I will add the code to the footer and see if there is a improvement.
But still 30 http requests even to a CDN is a bit much.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2011-03-11 00:36

Astor,
Are you wanting to take over with this module ( please do ) or are you just looking to add more meta tags? There is a <meta> tag generator module already.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2011-03-11 03:45
me wrote:
I think the XFBML sitll requires the <iframe>.

I was wrong. I will implement a XFBML version this weekend.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2011-03-24 02:18

new module that has more features and locations for placement.
Let me know if it works properly and if there is bugs or room for improvement.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Astor

Joined: 2005-12-15
Posts: 154
Posted: Thu, 2011-03-24 09:37
floridave wrote:
new module that has more features and locations for placement.
Let me know if it works properly and if there is bugs or room for improvement.

Great job but i have one question.
My meta og:title and og:site_name are always the same, is right?

examples:
<meta property="og:title" content="sempre la famosa cengia"/>
<meta property="og:site_name" content="sempre la famosa cengia"/>

<meta property="og:title" content="Tutti insieme al cartello Wien"/>
<meta property="og:site_name" content="Tutti insieme al cartello Wien"/>

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Thu, 2011-03-24 11:52

@floridave: Is this the xfbml version? If so, were there any improvements in performance?

Astor wrote:
My meta og:title and og:site_name are always the same, is right?

Ideally, the title is the name of the page (the image or gallery name in this case) and the site_name is the name of your site (e.g. Tom's Awesome Photo Gallery).

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2011-03-24 12:49

Site name is always the same and title is the of the album/item depending on the page you are on on so. so on the root album they would be the same. The site name is configured through the admin page.

This is not the xfbml version, I could not get it to work right so kept with the <iframe> version. It does allow comments ( if there is enough room ). The sidebar in most cases does not have enough room.

If you can make a xfbml version go for it. I really don't have much interest in this module anyway.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
lateatnight
lateatnight's picture

Joined: 2011-03-06
Posts: 15
Posted: Thu, 2011-03-24 14:16

Hi Dave,
I set up the new facebook like module, but the position "Show on bottom of resize photo." doesn't work.
This is an example
http://www.lateatgallery.org/index.php/Tales-from-2010/Fruit
In this moment there are active "Show on bottom of resize photo." and "Show on bottom of sidebar." but only the second is shown.
Others positions works also all at the same time.

Riccardo

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2011-03-24 17:04

Does it work with the wind theme? I never tested with the GD theme.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
lateatnight
lateatnight's picture

Joined: 2011-03-06
Posts: 15
Posted: Thu, 2011-03-24 17:09

Yes, it works. It seems a GD theme problem!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2011-03-24 17:45

He probably left out some of the hooks that the wind theme uses.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Thu, 2011-03-24 17:59
floridave wrote:
If you can make a xfbml version go for it. I really don't have much interest in this module anyway.

I may give it a go later (a few other Gallery3 things on the list first). I've never used the xfbml version so I'd have to see how it works. Plus, I'm not sure how to write code in a module; I just hardcode everything into the theme. I can likely figure it out by looking at the work you've already done, though.

 
Astor

Joined: 2005-12-15
Posts: 154
Posted: Thu, 2011-03-24 18:02
floridave wrote:
The site name is configured through the admin page.

Where is?

Astor wrote:
Great job but i have one question.
My meta og:title and og:site_name are always the same, is right?

I use GD, I tried with wind theme but nothing has changed.
og:site_name = og:title
the og:title is right album/item

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Thu, 2011-03-24 18:19
Astor wrote:
floridave wrote:
The site name is configured through the admin page.

Where is?

Log in. Go to Settings > Facebook like.

 
weegee77

Joined: 2010-11-25
Posts: 7
Posted: Tue, 2011-03-29 23:26

*Like* it so far.. but could you make it appear in the list of sidebar modules, where we can change the position of them, instead of fixed positions on top or bottom?

 
me.prosenjeet
me.prosenjeet's picture

Joined: 2011-05-20
Posts: 15
Posted: Mon, 2011-05-23 16:23

Using this on G3, initially all was fine and it was posting my "Recommend" on my Facebook profile page. But now as I keep adding images (only about 20), moment I click on "Recommend" it does put a post on my Facebook profile but the thumbnail displayed is of not the same image but another. Though clicking on the wrong thumbnail on FB does open the correct image.

------------------------------------------------
Something meaningful is always appreciated

 
weegee77

Joined: 2010-11-25
Posts: 7
Posted: Mon, 2011-05-23 17:01

this seems to be a facebook bug..
users of other image gallery systems report the same issue. Facebook caches the thumbnails much too long.
You should ask Facebook to fix that.

 
me.prosenjeet
me.prosenjeet's picture

Joined: 2011-05-20
Posts: 15
Posted: Mon, 2011-05-23 17:12

Thanks for your quick response, are you sure this is the case, 'cos wrong thumbnails on FB didnt change even when checked after few days.

---------------------------------------------
Something meaningful is always appreciated

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2011-05-24 14:11

Please provide a url to one that is wrong and I can look at the source to verify the code it passed to FP properly.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
me.prosenjeet
me.prosenjeet's picture

Joined: 2011-05-20
Posts: 15
Posted: Tue, 2011-05-24 17:18
floridave wrote:
Please provide a url to one that is wrong and I can look at the source to verify the code it passed to FP properly.

Dave

Hi, Thanks for your time
http://1087.lucknowwebs.com/index.php/333
Try recommending this image

--------------------------------------------
Something meaningful is always appreciated

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2011-05-24 20:54

Try this version http://gallery.menalto.com/node/98752?page=1#comment-371218 of the module.
If it works I will do some house cleaning on this thread as I see three different versions in this thread.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
me.prosenjeet
me.prosenjeet's picture

Joined: 2011-05-20
Posts: 15
Posted: Wed, 2011-05-25 00:27

Thanks Floridave,
This version worked and shows the correct thumbnail when recommended.
Thanks a lot for your time and help once again.
I think you need to clear this thread and remove the old versions of the same module.

--------------------------------------------
Something meaningful is always appreciated

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2011-05-25 00:58

House cleaning done in this thread.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Wed, 2011-05-25 05:31

Thanks for your efforts in coding and house-cleaning.

In trying out the latest version I find that the "Show on bottom of resize photo" option doesn't seem to work in Greydragon. I've tried playing with this using firebug, and I can see the code there but I can't work out what is preventing it from displaying on the screen. Let me know if you'd like me to PM you a demo URL.

U-G

Edit: I found it. It's at the top of the page. It was hidden behind the resize image. This is odd as it should follow after <div class="g-resize" but it is stacked behind it and I can't see why.

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Wed, 2011-05-25 15:58

I found a further problem, but this one is trickier. It causes a blank page of thumbs in virtual tab albums created by the new Tag Albums module. I'll PM you a link, but this may require rWatcher to assist.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2011-05-26 03:19

The issue with the GD theme is that if you look at photo.html.php of the theme, the is image is displayed with JavaScript.

</div>
<?= $script ?>

and the module displayed the info with:
<?= $theme->resize_bottom($item) ?>
That bit of code is rendered before the <?= $script ?>.
Not sure if Serge did that for a particular reason or not but perhaps he can position the <?= $theme->resize_bottom($item) ?> using some css or absolute positioning given the height of the resized image?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Thu, 2011-05-26 03:30

Thanks, much appreciated. I'll raise in the the GD thread. I tried a range of CSS-related things and I couldn't find a fix. I guess editing the theme code would work, but perhaps Serge has an idea. I try to minimise the extent to which I hack the theme code.

U-G

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Thu, 2011-05-26 14:04
floridave wrote:
The issue with the GD theme is that if you look at photo.html.php of the theme, the is image is displayed with JavaScript.

</div>
<?= $script ?>

and the module displayed the info with:
<?= $theme->resize_bottom($item) ?>
That bit of code is rendered before the <?= $script ?>.
Not sure if Serge did that for a particular reason or not but perhaps he can position the <?= $theme->resize_bottom($item) ?> using some css or absolute positioning given the height of the resized image?

I've realised that that's not it. The <?= $script ?> code at the very end preloads the next resize image - it doesn't load and position the current one. Anyway, I'll raise it in the GD thread because it's got me stumped.

U-G

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Thu, 2011-05-26 18:18

I believe I've found a bug in the facebook like module's sidebar code. In views/facebook_like_sidebar.html.php around line 30:

$item = $theme->item();
if (access::user_can($guest, "view", $item)) {

This seems to crash the sidebar on dynamic pages that are part of a collection (Tags, Latest Updates, etc) as $theme->item() does not exist.

For now, I've changed mine to use the view permission on the root album for dynamic pages, which seems to solve the problem:

$guest = user::lookup("1");
$item = "";
if ($theme->item()) {
  $item = $theme->item();
} else {
  $item = ORM::factory("item", 1);
}
if (access::user_can($guest, "view", $item)) {
  $show_like_code = true;
}
 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2011-05-27 00:10

rWatcher,
Thanks for that. Permission checks get tricky on dynamic albums ... so I go for your version and just check the root album if the guest can see it then it should be OK.
undagiga, see if this works better.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
me.prosenjeet
me.prosenjeet's picture

Joined: 2011-05-20
Posts: 15
Posted: Fri, 2011-05-27 01:43

I am using Gallery 3 and the facebook module version 1 (http://gallery.menalto.com/node/98752?page=1#comment-371218) as suggested by floridave few posts ago. It works fine but I have a query. Whenever I recommend an image it gets posted in my profile and not on my wall...is that fine? Not that well versed with FB hance asking

-------------------------------------------
Something meaningful is always appreciated

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Fri, 2011-05-27 03:20

It works for me. Thank you very much both Dave and rWatcher.

U-G

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2011-05-27 14:03

me.prosenjeet,
there is a couple of other FB modules that might do that I don't know.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Sun, 2011-05-29 10:26
undagiga wrote:
In trying out the latest version I find that the "Show on bottom of resize photo" option doesn't seem to work in Greydragon. I've tried playing with this using firebug, and I can see the code there but I can't work out what is preventing it from displaying on the screen. Let me know if you'd like me to PM you a demo URL.

Edit: I found it. It's at the top of the page. It was hidden behind the resize image. This is odd as it should follow after <div class="g-resize" but it is stacked behind it and I can't see why.

I've stumbled across a solution for this. See http://gallery.menalto.com/forum_theme_greydragon?page=31#comment-375073

On another topic, one of the annoying things about the iframe for Facebook Like is that it's hard to influence the CSS of its contents without going to the trouble of using javascript.

U-G