How to find the HxW of thumbnailHxW

  • Posts: 29
  • Thank you received: 2
12 years 2 months ago #62059

I've setup an integration between HikaShop and a Joomla content construction kit. The CCK queries the HikaShop tables to get various information including the image name. In previous versions of HS, all thumbnails were in the same thumbnail folder making this approach quite simple. With the newer version though, the thumbnails are in a folder named with the dimensions.

Is the dimension information stored in the database somewhere that I can query for it to fix my integration?
If not, is there a way to create all thumbnails in a single thumbnail folder instead?
Possibly using a plugin? I'm reaching for ways to make this work again.

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

  • Posts: 29
  • Thank you received: 2
12 years 2 months ago #62060

Here's the query I use to draw HS info into the CCK.

SQL Query:
	SELECT
	  concat_ws('|',
	    convert(product_id,char),
	    file_path,
	    product_name,
	    db_menu.id
	  ),
	  product_name
	FROM db_hikashop_file
	JOIN db_hikashop_product ON product_id=file_ref_id
	JOIN db_menu on published = published
	WHERE file_type='product'
	  AND db_menu.link='index.php?option=com_hikashop&view=product&layout=listing'
	  AND db_menu.parent_id=1

	GROUP BY product_name
	ORDER BY product_name,file_id desc

Last edit: 12 years 2 months ago by BRupholdt.

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

  • Posts: 82819
  • Thank you received: 13366
  • MODERATOR
12 years 2 months ago #62166

It's quite complex to know the thumbnails sizes available for an image by looking at the data in the database.
It can come from the Files/Images tab configuration options, it can come from a module or a menu option.

I see two simple ways to solve your issue:
1. Have HikaShop display the image. If you call the function display of the helper.image class, it will echo the HTML of the thumbnail and create the thumbnail in the correct folder if necessary.
2. Parse the thumbnail folders and see if the images have their thumbnail there.

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

  • Posts: 29
  • Thank you received: 2
12 years 2 months ago #62286

I'd considered parsing the folders to find the image but was hoping for a better way. I like the idea of having HS show the image but how would I go about that in a separate php file?

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

  • Posts: 82819
  • Thank you received: 13366
  • MODERATOR
12 years 2 months ago #62413

Like that:
if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')) return true;
$image = hikashop_get('helper.image');
echo $image->display('myimage.png',false,'My image file', '' , '' ,180, 120);

The following user(s) said Thank You: BRupholdt

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

  • Posts: 29
  • Thank you received: 2
12 years 2 months ago #62494

That worked perfectly and was a far better way than parsing for thumbnails that might not exist yet. Thank you!

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

Time to create page: 0.060 seconds
Powered by Kunena Forum