Keyword

Adding a Link to an Item Image

More
12 years 6 months ago #64475 by David
Adding a Link to an Item Image was created by David
Hello

Can any one help us with the following?
We would like to link an image from an item to a external link.
We have added the image using the "image tab" but are unsure how to add a link to this image.

The page with the image is here. www.websitechester.co.uk/index.php/workbooks/item/15-health-safety.

At present the image size is increased when you click on it. We would like the image to stay the same size but when clicked go to an external link. Is this possible?

Any help would be appreciated

Thanks

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

More
12 years 6 months ago #64476 by william white
Replied by william white on topic Re: Adding a Link to an Item Image
You will need to create a custom overide and modify item.php code at line 206
	  <?php if($this->item->params->get('itemImage') && !empty($this->item->image)): ?>
	  <!-- Item Image -->
	  <div class="itemImageBlock">
		  <span class="itemImage">
		  	<a class="modal" rel="{handler: 'image'}" href="<?php echo $this->item->imageXLarge; ?>" title="<?php echo JText::_('K2_CLICK_TO_PREVIEW_IMAGE'); ?>">
		  		<img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px; height:auto;" />
		  	</a>
		  </span>

		  <?php if($this->item->params->get('itemImageMainCaption') && !empty($this->item->image_caption)): ?>
		  <!-- Image caption -->
		  <span class="itemImageCaption"><?php echo $this->item->image_caption; ?></span>
		  <?php endif; ?>

		  <?php if($this->item->params->get('itemImageMainCredits') && !empty($this->item->image_credits)): ?>
		  <!-- Image credits -->
		  <span class="itemImageCredits"><?php echo $this->item->image_credits; ?></span>
		  <?php endif; ?>

		  <div class="clr"></div>
	  </div>
	  <?php endif; ?>
If the link it dynamic, you will need to use and extra field to hold the link text and fish it out of there to create the link

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

More
12 years 6 months ago #64477 by David
Replied by David on topic Re: Adding a Link to an Item Image
Hello William

Thanks very much for your reply it is much appreciated.

We are new to the K2 framework and php so creating a custom override is a little beyond us at present.
Is it possible you could recommend someone reliable we could employ to set this up for us.
I have 17 K2 items that i need to modify the image links on the same as the the one i have outlined.
If i could get one item set up with the image linked to the external url then hopefully i can do the rest.
We are wanting to link to flipbooks created here issuu.com/business.

Thanks again for your help.

David

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

More
12 years 6 months ago #64478 by David
Replied by David on topic Re: Adding a Link to an Item Image
Hello William

Thanks again for your reply. It is appreciated.
Please ignore the previous message, we have decided to use a text link to the flipbook to keep things simple.

We would be grateful for any advice on how we can have the image just as an image without it linking to a larger image and how we can stop the text from wrapping around the image and keep it aligned to the right of the image all the way down the page. I assume the latter is in the template.css but i am unsure.
www.websitechester.co.uk/index.php/workbooks/item/15-health-safety

No problem at all if you can't help with this.

David

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


Powered by Kunena Forum