Keyword

Showing Original Images

  • juro
  • juro's Avatar Topic Author
  • Offline
  • Senior Member
More
14 years 6 months ago #79363 by juro
Showing Original Images was created by juro
Hi,in a template, how can I show the original image, as opposed to a resized one?warm regardsRoland

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

  • juro
  • juro's Avatar Topic Author
  • Offline
  • Senior Member
More
14 years 6 months ago #79364 by juro
Replied by juro on topic Showing Original Images
Answering my own question (again). For this to work, you have to add the original image to the K2ModelItem.

In this file
/components/com_k2/models/item.php in line 103 (K2 v2.2) add this

$item->imageOrig='';

and after the other image declarations these lines:

if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'src'.DS.md5("Image".$item->id).'.jpg'))
$item->imageOrig = JURI::root().'media/k2/items/src/'.md5("Image".$item->id).'.jpg';

Now you can access the variable (and therefore the original image) inside any template by echoing

$this->item->imageOrig

I have no idea what implications this will have on stability, etc on your system and I only did preliminary testing. Maybe this could be added in K2, as sometimes people don't want scaling only regarding the width of an item.

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


Powered by Kunena Forum