Hello!
First of all, I love this plugin! I use it always.
I'm trying to use the plugin capturing the image directly from the "Intro image", you can put an image there clicking into "Images and links" and then "Intro image".
I saw a lot of posts in here, but I didn't found any of them talking about it.
Can anyone help me?
Thanks in advance!
Open Graph - Intro Image
- componentegd
- Phoca Member
- Posts: 21
- Joined: 31 Mar 2015, 22:39
- Location: Rio de janeiro - Brazil
- Contact:
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Open Graph - Intro Image
Hi, for now there is no such option, added to the feature request list.
Jan
Jan
If you find Phoca extensions useful, please support the project
- componentegd
- Phoca Member
- Posts: 21
- Joined: 31 Mar 2015, 22:39
- Location: Rio de janeiro - Brazil
- Contact:
Re: Open Graph - Intro Image
Thank you very much!Jan wrote:Hi, for now there is no such option, added to the feature request list.
Jan
Is there anything I can do to help?
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Open Graph - Intro Image
Hi, if you are able to customize it (php skills) and you will modify it for your self, will be great to get a guide
Jan
Jan
If you find Phoca extensions useful, please support the project
- componentegd
- Phoca Member
- Posts: 21
- Joined: 31 Mar 2015, 22:39
- Location: Rio de janeiro - Brazil
- Contact:
Re: Open Graph - Intro Image
Ok. I'll try something and I'll post here soon as I get some answer.Jan wrote:Hi, if you are able to customize it (php skills) and you will modify it for your self, will be great to get a guide
Jan
My greatest problem with joomla is that I'm not that good with OO.
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
- componentegd
- Phoca Member
- Posts: 21
- Joined: 31 Mar 2015, 22:39
- Location: Rio de janeiro - Brazil
- Contact:
Re: Open Graph - Intro Image
I manage to find a solution, but I would like a help to make it "pro" solution.
I'll post here the code I used to it, but it only will work if there is no image into the article, only in the "intro image".
I'll post now where is it being to work
Jan, do you think we can get it to work better? I'm not that expert into PHP skills. Besides, OO kills me lol
I'll post here the code I used to it, but it only will work if there is no image into the article, only in the "intro image".
Code: Select all
// Article Image
$article = JTable::getInstance("content");
$article->load(JRequest::getInt("id")); // Get Article ID
$article_images = $article->get("images"); // Get image parameters
$pictures = json_decode($article_images); // Split the parameters apart
// Print the image
//echo "<img src='" . $pictures->{'image_intro'} . "' alt='" . $pictures->{'image_intro_alt'} . "'>";
$document->setMetadata('og:image', $pictures->{'image_intro'});
Code: Select all
// Image
// Article Image
$article = JTable::getInstance("content");
$article->load(JRequest::getInt("id")); // Get Article ID
$article_images = $article->get("images"); // Get image parameters
$pictures = json_decode($article_images); // Split the parameters apart
// Print the image
//echo "<img src='" . $pictures->{'image_intro'} . "' alt='" . $pictures->{'image_intro_alt'} . "'>";
$document->setMetadata('og:image', $pictures->{'image_intro'});
if ($this->params->get('image'.$suffix, '') != '') {
$document->setMetadata('og:image', JURI::base(false).htmlspecialchars($this->params->get('image'.$suffix, '')));
} else {
// Try to find image in article
$img = 0;
$fulltext = '';
if (isset($row->fulltext) && $row->fulltext != '') {
$fulltext = $row->fulltext;
}
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Open Graph - Intro Image
Hi, which file you are trying to customize and which version of the plugin?
Jan
Jan
If you find Phoca extensions useful, please support the project
- componentegd
- Phoca Member
- Posts: 21
- Joined: 31 Mar 2015, 22:39
- Location: Rio de janeiro - Brazil
- Contact:
Re: Open Graph - Intro Image
Hi! I'm using the last version of the plugin.Jan wrote:Hi, which file you are trying to customize and which version of the plugin?
Jan
The file is: "plugins/content/phocaopengraph/phocaopengraph.php"
I just added that code posted above. But I would like to make this work better.
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Open Graph - Intro Image
Ok, will be great if you can paste whole code of the phocaopengraph.php
If you will use GIST (on GitHub) will be great - to see the changes.
Jan
If you will use GIST (on GitHub) will be great - to see the changes.
Jan
If you find Phoca extensions useful, please support the project