4images Forum & Community
General / Allgemeines => Programming => Topic started by: jeyjoo on March 01, 2011, 01:10:38 AM
-
Hi,
I use version 1.7.6
My gallery is at www.jeyjoo.com/gallery/index.php
My detail page currently displays a like button count using Facebook OGP. when clicked the user likes the search page.
I would like to change this such that the user can like each individual URL.
To do this I need a way of automatically specifying:
1. The image url
2. The page to like URL (the current page url for each image)
and preferably:
3. title tag (using image title) e.g. <meta property="og:title" content="image of ....."/>
4. description tag using image description e.g. <meta property="og:description" content="image description.............."/>
Any ideas,
Thanks,
Mike
-
I can't access your site. AFAIK if you use the FBXML (or whatever the facebook freaks call their crap) like button and don't provide any URL it does take the current URL, doesn't it?
This PHP code would give you your current URL though:
$url = "http" . ((!empty($_SERVER['HTTPS'])) ? "s" : "") . "://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
And you can play around with that. I did a dirty hack using this as a basis in the functions.php to provide me with an absolute path to the thumbnail image which I include in the og:image meta tag.
-
$url = "http" . ((!empty($_SERVER['HTTPS'])) ? "s" : "") . "://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
Thanks. Tjhis is somehting like what I was looking for, though:
- where exactly do I place this code?
- how do I call it in the HTML e.g. is it [URL]?
- how do I create the img thumbnail call?
Much appreciated,
mike
p.s. my gallery is back up after a server issue yesterday!
-
Same problem... Please someone help us. :)
-
I hate to delude, but I have not "done it"... everytime a user like's or tweets a page, they are actually liking the same page every time (my search page, which shows latest images posted). Consequently, a user can only click like on my site once.
Anyway, the required code is below:
EDIT HTML TAG TO INCLUDE FOLLOWING:
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml">
INSERT IN HEADER TAG
<meta property="og:title" content="5-a-day images @ Jeyjoo Gallery"/>
<meta property="og:description" content="Surf and sand... the best beaches in England"/>
<meta property="og:url" content="INSERT URL TO LINK TO"/>
<meta property="og:image" content="INSERT IMAGE TO SHOW ON FACEBOOK"/>
<meta property="og:type" content="company"/>
<meta property="fb:admins" content="INSERT YOUR FB ADMIN ID"/>
INSERT THIS BETWEEN BODY TAGS, WHERE YOU WANT THE LIKE BUTTON TO APPEAR
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:like href="INSERT HERE THE URL TO LIKE - THE LIKE COUNT WILL BE APPLIED TO THIS SPECIFIC URL" layout="button_count" show_faces="false" width="40" font="trebuchet ms"></fb:like>
Hope this helps,
Mike
www.jeyjoo.com
-
<meta property="og:image" content="how can do this images for every single post automatically?"/>
-
Thats what I would like to know. Leaving it image blank does not work either.
There is a mod here, but it would not work on my version of 4images.
http://www.4homepages.de/forum/index.php?topic=17912.0
Let me know if you have any success with this.
-
<meta property="og:image" content="http://yourwebsite.com/{media_src}"/>
-
Thanks Jakarta, that's awesome. Here is an update of the full code to like an image.
I have also added a generic title, and the image description will be the name you have given to the image being liked.
STILL MISSING - the URL tag needs modifying to automatically pick up the actual link - I am working on this.
EDIT HTML TAG TO INCLUDE FOLLOWING:
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml">
INSERT IN HEADER TAG
<meta property="og:title" content="Jeyjoo Image Gallery"/>
<meta property="og:description" content="{image_name}"/>
<meta property="og:url" content="LINK TO LINK BACK TO"/>
<meta property="og:image" content="http://www.jeyjoo.com/gallery/{media_src}"/>
<meta property="og:type" content="company"/>
<meta property="fb:admins" content="INSERT YOUR FB ADMIN ID"/>
INSERT THIS BETWEEN BODY TAGS, WHERE YOU WANT THE LIKE BUTTON TO APPEAR
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:like href="INSERT HERE THE URL TO LIKE - THE LIKE COUNT WILL BE APPLIED TO THIS SPECIFIC URL" layout="button_count" show_faces="false" width="40" font="trebuchet ms"></fb:like>
-
<meta property="og:image" content="http://yourwebsite.com/{media_src}"/>
Doesnt work for me :(
-
I have just posted what I think should work...
Waiting for it to be moved to the mods section before posting the link.
I could not get the above to work on my system either so I went about it a little differently.
@jeyjoo,
I hope you do not mind that I did this...
-
Check1 - you need your insert your website name, in my case www.jeyjoo.com
Check 2 - you probably need the extension for your gallery - mine is simple called "gallery", so I add www.jeyjoo.com/gallery
In my case, the whole line of code reads <meta property="og:image" content="http://www.jeyjoo.com/gallery/{media_src}"/>
-
for current page url this should work, add this in the top of header
<?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>
and
<meta property="og:url" content="<?php echo curPageURL(); ?>" />
-
I found an easier way. Modify your details.php file and add the tag "full_url" see below instuctions.
Now you can use the {full_url} insert tag for your header meta stuff.
search in your details.php:
if ($image_allow_comments == 1) {
$site_template->register_vars(array(
and replace:
if ($image_allow_comments == 1) {
$site_template->register_vars(array(
"full_url" => $script_url."/details.php?".URL_IMAGE_ID."=".$image_id,
-
wow !! that helped me a lot... in my case it works with...
<link rel="image_src" href="{media_src}" />
-
Yes i am in the same situation. it works like that .