#113 Posted in ‘Econa’

Latest post by Lefteris Kavadas on Tuesday, 27 February 2018 21:50 EET

Ivan Vlasov
 Hello!
I found one flaw in using the Econa k2 plugin. I want to know how to fix it

On the K2 itemlist page in control panel used native k2 images (md5)
If I delete native images from the server I'm lose images in the control panel.
Tell me please how to display the Econa plugin images in control panel
By default, the following code is in the control panel:


<?php if(JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$row->id).'_XL.jpg')): ?>
                                <a href="https://www.firecoders.com/<?php echo JURI::root(true).'/media/k2/items/cache/'.md5("Image".$row->id).'_XL.jpg'; ?>" title="<?php echo JText::_('K2_PREVIEW_IMAGE'); ?>"     class="modal">
                                <?php if(K2_JVERSION == '30'): ?>
                                <img src="https://www.firecoders.com/<?php echo JURI::root(true).'/media/k2/items/cache/'.md5("Image".$row->id).'_M.jpg'; ?>" />
                                <?php else: ?>
                                <?php /*<img src="https://www.firecoders.com/templates/<?php echo $this->template; ?>/images/menu/icon-16-media.png" alt="<?php echo JText::_('K2_PREVIEW_IMAGE'); ?>" />                 */ ?>
                                <?php endif; ?>
                                </a>
                                <?php endif; ?>



What code should I use to display econa's images? Thank you

Lefteris Kavadas
Hi,

You are not supposed to delete the K2 native images. This will break K2. If you have a backup, please restore the images.

Regards

Ivan Vlasov
why? econa k2 plugin have option "Keep native images" and checkbox "yes" or "no".
I want use only econa's images for save disk space.

Please tell me how can I use the images of econa in the K2 control panel? how do I print an econa image instead of
<img src="https://www.firecoders.com/<?php echo JURI:: root (true).'/media/k2/items/cache/'.md5 ("Image".$row - >id).'_M.jpg' ?> > "

Lefteris Kavadas
When you enable this option Econa will only generate the required images but will leave untouched the XL image because K2 is using it at the administration preview.
That's why we suggest restoring your backup if that's an option.
If you insist not to do so, you can try to trigger the plugin like that:

Before the loop
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$params = JComponentHelper::getParams('com_k2');


Inside the loop:
$dispatcher->trigger('onK2PrepareContent', array(&$row, &$params, 0));

Note that this has not been tested and it might not work as expected.

Regards

Ivan Vlasov
I'm sorry
But this code does not work!
The first part I added immediately before defined
('_ JEXEC') or die;

The second part inside loop.
I do not know php very well and
Maybe I did something wrong.

Could you correct my code to reflect your edits?

Could you give me a full fragent code?
I'm using K 2.8

Now I have
<?php if(JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$row->id).'_XL.jpg')): ?>
<a href="https://www.firecoders.com/<?php echo JURI::root(true).'/media/k2/items/cache/'.md5("Image".$row->id).'_XL.jpg'; ?>" title="<?php echo JText::_('K2_PREVIEW_IMAGE'); ?>" data-fancybox="gallery" data-caption="<b><?php echo $row->title; ?></b> - <?php echo JText::_('K2_PUBLISHED_IN'); ?> <b><?php echo $row->category; ?></b> <?php echo JText::_('K2_BY'); ?> <b><?php echo $row->author; ?></b>">
<?php if(K2_JVERSION == '30'): ?>
<img src="https://www.firecoders.com/<?php echo JURI::root(true).'/media/k2/items/cache/'.md5("Image".$row->id).'_M.jpg'; ?>" />
<?php else: ?>
<img src="https://www.firecoders.com/templates/<?php echo $this->template; ?>/images/menu/icon-16-media.png" alt="<?php echo JText::_('K2_PREVIEW_IMAGE'); ?>" />
<?php endif; ?>
</a>
<?php endif; ?>


Thank you!

Ivan Vlasov
If this code can not work, then maybe there is an alternative?

Replace forcibly <img src="https://www.firecoders.com/<? Php echo JURI :: root (true). '/ Media / k2 / items / cache /'. Md5 (" Image ". $ Row-> id) .'_ M.jpg '; ?> "/> to the code that will output from the image database Econa plugin

Ivan Vlasov
I use plugin xtlink item k2.
The plugin makes it possible to add similar elements to articles k2.
I was able to display Econa images in this plugin in the front end.
I used the code:
if ($item_params->get('XTlinkedItemImage', 0))
							{
		// Get current image information
        $image = JTable::getInstance('Image', 'EconaK2Table');
        $image->load(array(
            'resourceId' => $XTlinkedItem->id,
            'resourceType' => 'com_k2.item',
        ));
								$imgi = JPATH_SITE .
									'/media/k2/items/cache/' .
									md5("Image" . $XTlinkedItem->id) . '_' .
									$item_params->get('XTlinkedItemImageSize') . '.jpg';

								if (JFile::exists($imgi))
								{
									$XTlinkedItem->image = JURI::root() .
										'media/k2/items/cache/' .
										$image->filename .
										'_' . $item_params->get('XTlinkedItemImageSize') .
										'.jpg';
								}
							}


But I can not get Econa images in the standard admin panel
Help please
Any solution is suitable

Lefteris Kavadas
I do not know what this plugin is or what it does.
The code that I provided should work. The only difference is that you need to change the preview image to the following:
<img src="https://www.firecoders.com/<?php echo $row->imageXLarge; ?>" />

Please try and let me know.

Ivan Vlasov
Super!
It works!
Thank You very much!

Lefteris Kavadas
You are welcome.
If you like Econa for Joomla please post a review at the Joomla extensions directory. It's really important for us!
Feel free to create a new ticket if you need anything else.

Regards

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