Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Need help calling JDOM in Module 07 Jul 2021 14:25 #15847

Hi,
I'm creating a module for my component and thought I would use the JDom to call up an image.

I'm using this as document page as a guide... www.j-cook.pro/index.php/m/module

My component is called com_organicshop. My image field is "main_image".

In my module default.php I have...
// Set up the component for JDom
	$dom = JDom::getInstance();
	$dom->set('extension', 'com_organicshop');
Is the "extension" bitcorrect?

Also
<?php // Item Image
	echo JDom::_('html.fly.file', array(
	   // Furnish the image relative path
	  'dataValue' => $item->main_image,				 
          // Define as indirect, with the root directory alias
	  'root' => '[DIR_FILES_MAIN_IMAGE]',
	  'indirect' => true,
          // Some options for Thumb creation
	  'height' => 50,
	  'width' => 50,
	  'attrs' => array('center','crop','fit'),								
));?>

But the JDom isn't showing the image - it is not rendering. Instead I'm getting this output...
<img src="/index.php?option=com_organicshop&amp;task=file&amp;size=50x50&amp;attrs=center:1,crop:1,fit:1&amp;path=[DIR_FILES_MAIN_IMAGE]/shoelaces.jpg">
Any ideas?
Just call me Chris :)

Please Log in or Create an account to join the conversation.

Last edit: by organicwebs.

Need help calling JDOM in Module 07 Jul 2021 14:52 #15848

I worked it out...

'indirect' needed to be "false"... and 'root' needed to be "DIR_TABLE_FIELD"
<?php // Item Image
	echo JDom::_('html.fly.file', array(
	   // Furnish the image relative path
	  'dataValue' => $item->main_image,				 
	  // Define as indirect, with the root directory alias
	  'root' => '[DIR_ITEMS_MAIN_IMAGE]',
	  'indirect' => false,
	  // Some options for Thumb creation
	  'height' => 50,
	  'width' => 50,
	  'attrs' => array('center','crop','fit'),								
));?>

Pretty nifty. B)

I'm still discovering these little gems in JCook!
Just call me Chris :)

Please Log in or Create an account to join the conversation.

Need help calling JDOM in Module 21 Jul 2021 20:59 #15849

good work :)

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.078 seconds

Awards for the best Joomla app. This product is gonna win an award for this amazing job. Cook Self Service is the the best application from all over the Joomla universe ! It brings Joomla to a professional level really advanced for developers. It is a real fun to develop with it. The ACL part and security checks implementation are just... so much hours saved. I can now concentrate myself more on the design part and the creative works. Thank you so much. Guys I offer you all my congratulation ! Keep up the works because Joomla is needing it to increase the quality of extensions availables on the JED. I also learned a lot because I can see how to code at the proper place and I found all my answers reading the forum.
lack_hanson (JED)
          

Get Started