#82 Posted in ‘Econa’

Latest post by Lefteris Kavadas on Wednesday, 11 October 2017 11:38 EEST

Petr Foltán
Hello,
first of all: econa is great extension.

About my problem: I want to use module "News Show Pro GK5". Problem is that it is not showing image uploaded by econa.
News Show Pro GK5 have options to show "Intro image", "Full image" or "First article image", but noone works with econa. Can you help with it?

If I look into sourcecode Econa image is above <section class="article-content">, so if it will be under this section, it may work with "First article image".

Thanks for answer

Lefteris Kavadas
Hi,

If you are using Econa as a Joomla custom field then the module should display the image. I guess that the module works with custom fields. If not, i am pretty sure that they will add it soon.
You can always contact the Gavick support team and ask them to add custom fields support to the module.

If you are using "Econa Image Tab" then in order to make Econa work, the module should support content plugins. The plugin event that Econa is using is "onContentBeforeDisplay". Check if the module has an option for that.

We recommend to use Econa as Joomla custom field and ask Gavick team to add support for custom fields.

If that's not possible, then tell me if you are using Econa as custom field or not and i can provide you the required code to add to the module layout override.

Finally, since you like Econa it would be great if you could post a review at the Joomla Extensions Direcroty .

Regards

Petr Foltán
Hello,
thanks for answer. I used Econa Image Tab, but when I tried Econa as a Joomla custom field it is the same. News Show Pro GK5 not supports joomla custom fields and not support content plugins.

I tried some more similar news display modules and it is the same, they can not display image, which is before content.

So it may work if instead of using onContentBeforeDisplay to load econa image in template overide in com_content/article/default.php and place it after <section class="article-content clearfix">. Than it will work to load first image of article. But I donť know what code to use for it.

I'm using Econa Image Tab now.

Lefteris Kavadas
Here is the code you can use to make it work. Note that this code should be placed at a layout override of the module in your template. If you don't know what layout overrides are please read first the Joomla documentation .

$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('content', 'econa');
$row = (object) $item;
$row->params = new JRegistry();
$row->catid = 0;
$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.article', &$row, &$row->params, 0));
$result = trim(implode("\n", $results));
$output_html .= $result;


This code has to be added in the override of file tmpl/view.php in line 50.

If you find hard to apply this code, then i suggest to contact the Gavick support team and ask them to help you or add support for onContentBeforeDisplay plugin event to the module.

Petr Foltán
Hello,
this works, but it is not exactly what is needed. It display image in content display, but I need to use image create thumbnail from "News Show Pro GK5", because now it display econa image with dimensions from article display which is much more bigger than it is needed to display in module.

I think it may be better to use "First article image" option in "News Show Pro GK5" and than modify layout override of the module tmpl/com_content/view.php and in this on line 210:
$IMG_SOURCE = NSP_GK5_com_content_View::getImageFromText($item['text']); replace this line with something like:
$IMG_SOURCE = JURI::root().'images/econa/content/article/'.$image->filename.'_'.$identifier.'.$image->extension';

In this simmilar way the module took images in K2, so it will work, but I don't know how to get correct image name.
'.$image->filename.'_'.$identifier.'.$image->extension' is not working

Lefteris Kavadas
What you want to do is not that simple. You have to query the database to get the image filename.
The code to do this can be found in the file /plugins/content/econa.php.
If you insist doing this we would be more than happy to help you but we will not able to provide further support on this at the future.
This would be a hack and this means that can break anytime at the future with an update.

Instead of hacking this, we recommend to use the code we provided. The image size is not really an issue since Econa will automatically serve the correct image size depending on it's settings.



Petr Foltán
Hello,
yes econa serve resized image, but the module will show the same size as it is setup on article view. But in article view I want big image image and in module only small one.
So I want to try change code and I'm aware of what it will mean in future changes.

Lefteris Kavadas
Assuming that you know the article ID here is how you can get the information from the database:

$id = 'YOUR_ARTICLE_ID';
JTable::addIncludePath(JPATH_SITE.'/plugins/content/econa/tables');
$table = JTable::getInstance('Image', 'EconaContentTable');
$table->load(array('resourceId' => $id, 'resourceType' => 'com_content.article'));


The table variable will give you all the required properties you need to build the image URL ( or file path ).

Petr Foltán
It works great, thanks a lot!

Lefteris Kavadas
You are welcome.

Note: An active subscription is required in order to get support for our paid extensions. For our free extensions, if you don't have an account, register and then submit your support request.  In case you just want to ask a question, you can also use the contact form .

Firecoders
Are you using our extensions? Please post a review at the Joomla extensions directory!
Post a review