Page 1 of 1

prettyphoto how do i grab the image url for the facebook lik

Posted: Sun Mar 08, 2015 11:59 pm
by sjanej
Hi, I cant seem to get the facebook like button to work correctly. I changed some of the coding in jquery.prettyphoto.js and now it works to a degree, however, its only grabbing the website url and not the photo url. Ive done the same with the share button and it, at least, grabs the category html name ie motherofthebride.html but it wont display the actual photo im sharing on facebook. There is obviously something wrong in the jquery.prettyphoto.js but im not a coder so im a bit stuck. Im using the latest version of Gallery and prettyphoto.

In summary, its displaying the following on my facebook page
http://www.mywebsite.com
I want it to display
http://www.mywebsite.com/motherofbride.html#prettyPhoto[21]/1/

Actual code

Code: Select all

<__iframe src="//www.facebook.com/plugins/share_button.php?href={location_href}&layout=button" scrolling="no" frameborder="0" style="border:none; width:55px; height:30px; overflow:hidden;" allowTransparency="true"></__iframe><div class="facebook"><__iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href=http%3A%2F%2Fwww.mywebsite.com&layout="button&show_faces=false&width=390&action=like&font&colorscheme=light&height=80" scrolling="yes" frameborder="0" style="border:none; overflow:visible; width:390px; height:80px;" allowTransparency="true"></__iframe></div>
I do realise I have mywebsite.com in the href for the like button at the moment but the button will not work at all if I have the location_href as it is with the share button.

I hope Ive explained this correctly. Thanks

Re: prettyphoto how do i grab the image url for the facebook

Posted: Mon Mar 09, 2015 11:26 am
by velden
Not sure how this is related to cmsms as you don't tell us what module you use (I assume Gallery).

Where is {location_href} coming from?

Re: prettyphoto how do i grab the image url for the facebook

Posted: Mon Mar 09, 2015 7:23 pm
by sjanej
Gosh sorry. Yes, its the Gallery module and Im using the prettyphoto template. It uses the file jquery.prettyphoto.js and this is where I have found the code for the facebook like button. Ive also added a facebook share button which seems to work while using the {location_href} code but this doesnt work for the like button. Further down in the script it has the following code:

Code: Select all

facebook_like_link=settings.social_tools.replace("{location_href}",encodeURIComponent(location.href));
Im not sure if this last bit of code is causing the problem. Obviously I want to have the image liked or shared rather than the page but the share button just cuts it off at the .html and the like button just wont work with the {location_href} thus the need to put a page url there which defeats the purpose.