× Joomla Facebook Connect support forum

Topic-icon How to set the right image from K2 images and Joomgallery Photo

Active Subscriptions:

None
Hi There,

First of aal thanks for the great component, gladd we found it. It works like a charm. We use the Jomsocial plugin for login and the comments for K2 articles. The comments module we use for other components like Joomgallery and Eventlist.

It's urgent when somebody comment on a article or photo (joomgallery) that the first image in a K2 article, the photo of Joomgallery (detail view), or the image of an event in eventlist is posted to Facebook.

Can you tell me how to do that. I read the forum for some hours a seen you have to set the Open Graph setting. But we have a big site with daily a lot of new articles and photo shoots (over 1500 photos weekly). So it will be a huge job to put the tag of Open Graph in every article and I don't know how to put it in Joomgallery.

Hope you can help us out or can tell us whats possible or not.

Keep up the good work!

Regards,

Jeroen
The topic has been locked.
Support Specialist
Jeroen,
We're glad you found JFBConnect too!

With the 4.0 release, we added the functionality to the Open Graph area to use the first image in an article automatically as the image tag. In the Social configuration area, in the Open Graph tag, just enable "Use first image in article for default" and that will work for K2 and Joomla content. One caveat, and it may be your issue, is that this only works for images 'in' the content. Not the separate article tab in K2 that let's you specify an article image.

In addition, the {JFBCGraph image=http://site.com/image.jpg} tag can be inserted directly into the templates of JoomGallery or Eventlist. Unfortunately, I'm not familiar with those components, but if there's a template override you can create, or if you know where the image is being generated and sent to be displayed to the user, you can add that tag and hopefully use whatever variable is available to you for the image. The JFBCSystem plugin will detect this tag and should properly insert the Open Graph image tag for you.

Hope that makes sense. You may be able to ask the developers of those components about how/where you could identify the first image shown, and we can help you from there.

If you need anything else, just let us know,
Alex
The topic has been locked.
Active Subscriptions:

None
Hi Alex,

Thanks for your reply! I set the open graph function to enabled in the backend and select to use the first image of an article. When this is enabled it doesn't use the first image of the K2 article, it use an other picture (random) of the site. Do I have to set some more settings in the backend?

Also I see there is an problem with posting a comment on the users Jomsocial wall. So when somebody post a comment on an article earlier on the activitystream/wall of the user we seen, (for example) user.. comment, where 'comment' is the comment of the user. How can we fix this? We would like to see on the wall when somebody posted a comment. Maybe i changed somekind of a setting?

Thank for you reply on this!

Regards,

Jeroen
The topic has been locked.
Support Specialist
Jeroen,
When you update the Open Graph tags, it can take Facebook 24 hours (or so) to re-scan your pages and see the changes. You can use their URL debug tool, below, to check immediately how they see your page with the updates:
developers.facebook.com/tools/debug

Check that out and see if the image tag is correct. If not, let us know the URL of a page that you're trying this on, and we'll see if we notice any common errors or problems.

As for the JomSocial wall, I'm not exactly sure what you're saying. JFBConnect doesn't post Facebook comments into the user's wall, so not sure how that's happening. I may just be mis-understanding the problem.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
Hi Alex,

With Joomgallery and Eventlist is the problem with the right image solved. It work fine now.

Only with the image from K2 content there is a problem. In the backend the Opengraph setting and the setting to pick the first image in a K2 item is enabled. In the default settings box nothing is filled in, is that right?

Here's a url so you can check what facebook see and wich image facbook pick from the K2 item: www.dancegids.nl/interviews/interviews/i...-from-your-life.html

Hope you can see where it goes wrong, off course the K2 plugin is enabled too.

Kind regards,

Jeroen
The topic has been locked.
Support Specialist
Jeroen,
The "Use first image in K2" setting only works for images in the articles text. It doesn't work with K2's "Image" tab where you can set an image for that article. The reason is because, in our content plugin, we're only handed the text of the article by K2. We can't see the 'item image' that is set directly. It's something we're looking into to figure out how to do, but don't have any great solutions right now.

So, in this case, we won't be able to automatically add the image, but you can do so manually by placing the following text in the article:
{JFBCGraph image=http://site.com/link-to-your-image.jpg}
We'd recommend placing that tag at the end of your article so that it doesn't mess with some of the K2 logic for using the first 100 chars of intro text for certain things.

I know this isn't optimal, but hopefully, helps you accomplish what you're trying to do. We'll be looking to find a better solution for using the Item Image, and will update JFBConnect in a future release with that ability.

Hope that helps explain,
Alex
The topic has been locked.
Active Subscriptions:

None
Hi Alex,

After long searching on the web I found a solution (for now) for using the item image of a K2 item (in item view). Found it on the K2 Forum: community.getk2.org/forum/topics/item-im...8649&page=1#comments

You have to put the following code in /components/com_k2/views/item/view.html.php in the metadata section:

if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_XS.jpg')) { $document->addCustomTag('id).'_XS.jpg">');
}

The the item image will be used when somebody place a comment on a K2 item ;-)

May be you can use this information for developing a K2 content plugin?

For now I only have to fix the problem for eventlist, I know where the original image is build, now I only have to now how I can put it in the php code of Eventlist. You tag is only working on content. Maybe you have an idea how to put it in the php code?

Hope to see your reaction soon!

Kind regards,

Jeroen

EDIT: Eventlist is also fixed now. It's al working fine right now.
The topic has been locked.
Support Specialist
Jeroen,
Thanks for sharing what worked for you. We'll definitely be looking into this for the 4.1 release, and appreciate the code snippet. Always good to have a starting point :)

Sounds like you're all set up now, but if you need anything else, you know where to find us!

Thanks again,
Alex
The topic has been locked.