#113 – Econa plugin images for k2 in control panel

Status: Closed - Category: Econa
 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="/<?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="/<?php echo JURI::root(true).'/media/k2/items/cache/'.md5("Image".$row->id).'_M.jpg'; ?>" />
                                <?php else: ?>
                                <?php /*<img src="/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
 
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
 
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="/<?php echo JURI:: root (true).'/media/k2/items/cache/'.md5 ("Image".$row - >id).'_M.jpg' ?> > "
 
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
 
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="/<?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="/<?php echo JURI::root(true).'/media/k2/items/cache/'.md5("Image".$row->id).'_M.jpg'; ?>" />
<?php else: ?>
<img src="/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!
 
If this code can not work, then maybe there is an alternative?

Replace forcibly <img src = "<? 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
 
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

 
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="/<?php echo $row->imageXLarge; ?>" />

Please try and let me know.
 
Super!
It works!
Thank You very much!
 
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
 
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.

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 .

Note: Our support team is currently on vacation, so please anticipate slightly longer response times. Thank you for your understanding!

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