Your Cart is currently empty!
Product update
Coupon
add
Coupon code invalid! Please re-enter!
AJAX loader
You are here: HomeForum
Welcome, Guest

Issue 2: Yt K2 Slideshow II
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Issue 2: Yt K2 Slideshow II

Issue 2: Yt K2 Slideshow II 11 years, 5 months ago #5445

Website: sjwn25.csn2011go.com


Dear SmartAddons,

Recently, I had an issue with this module showing all articles with and without images.

You eMailed me a code that works just great!

Now, it is showing only articles with pictures.

But, as you can see, it is now showing also articles that have a small picture in body and no picture at the top of the article (see first picture).

I would like it to display only the BIG top image (the one you upload with K2 in the editor).

I appreciate your cooperation on this issue.

Sunny regards,

Willem

Re: Issue 2: Yt K2 Slideshow II 11 years, 5 months ago #5459

  • loitt
  • OFFLINE
  • Platinum Boarder
  • Posts: 2222
  • Karma: 48
Dear Willem S.A. Da Costa Gomez,

I think that you can input the image in the tab "Image" in K2 item.

K2 slideshow II module is get the image of k2 items in the tab "Image" first.

Thanks
Ticket System | Join our Clubs to download our extensions and templates

Re: Issue 2: Yt K2 Slideshow II 11 years, 5 months ago #5464

Dear SmartAddons,

Caribseek News is an online Wider Caribbean news service.

Some news items come with big pictures and other with small pictures.

Examples:

Big picture: sjwn25.csn2011go.com/index.php/k2-component/k2-pages/k2-categories/latin-america/item/195
Small picture: sjwn25.csn2011go.com/index.php/k2-component/k2-pages/k2-categories/latin-america/item/197

In further study I found that K2 uses different image css selectors for images in the top and in the txt (ks.css):

1. Top (big picture):

itemImage
div.itemImage
span.itemImage
span.itemImage img

2. Image in text:

div.itemIntroText img
div.itemFullText img

I am not a php programmer, but I think that if you refine the code that you already sent me to select only an image with itemImage, then the problem is solved.

I thank you in advance for your cooperation and I hope to hear from you soon.

Sunny regards,

Willem

Re: Issue 2: Yt K2 Slideshow II 11 years, 5 months ago #5468

  • loitt
  • OFFLINE
  • Platinum Boarder
  • Posts: 2222
  • Karma: 48
Dear Willem S.A. Da Costa Gomez,

I think that you can input the big image in the tab "image".

K2 slideshow II module is displayed these images.

If you want to get itemImage, you can change the code of module.

Note: maybe much code.

Thanks
Ticket System | Join our Clubs to download our extensions and templates

Re: Issue 2: Yt K2 Slideshow II 11 years, 5 months ago #5477

Dear SmartAddons,

Thank you for your eMail.

Like I said, I am not a php programmer, but a conceptual thinker.

And I think that I have a simple solution.

I am assuming that Joomla!/K2 is storing the K2 top image in another than the images in the text that are places with the content editor.

So, in the php code that you already sent me - see below - you only have to check if there is a K2 Top Image stored. So, if I am correct, you only need to change this:

if(!empty($item['thumb'])){
$tmp[] = $item;
}

I hope to hear from you soon.

Sunny regards,

Willem



This is the code that you already sent me:
--------------------------------------------------------

function update($items){
$tmp = array();

foreach ($items as $key => $item) {
if (!isset($item['sub_title'])) {
$item['sub_title'] = $this->cutStr($item['title'], $this->max_title);
}
if (!isset($item['sub_main_content'])) {
$item['sub_main_content'] = $this->cutStr($item['content'], $this->max_main_description);
}
if (!isset($item['sub_normal_content'])) {
$item['sub_normal_content'] = $this->cutStr($item['content'], $this->max_normal_description);
}
if (!isset($item['thumb']) && $item['img'] != '') {
$item['thumb'] = $this->processImage($item['img'], $this->thumb_width, $this->thumb_height, $item['id']);

} else {
$item['thumb'] = '';
}
if($this->imagesource == 1){
$item['thumb'] = $item['img'];
}
if($item['thumb'] == ""){
if($this->themes == 'theme5'){
$item['small_thumb'] = JURI::base()."modules/mod_yt_k2_slideshowii/assets/no_images.png";
}
}else{

$item['small_thumb'] = $this->processImage($item['img'], $this->small_thumb_width, $this->small_thumb_height, $item['id']);

}

if(!empty($item['thumb'])){
$tmp[] = $item;
}

}

return $tmp;

}

Re: Issue 2: Yt K2 Slideshow II 11 years, 5 months ago #5483

  • loitt
  • OFFLINE
  • Platinum Boarder
  • Posts: 2222
  • Karma: 48
Dear Willem S.A. Da Costa Gomez,

Please continue to change the code of k2 slideshowii module.

Go to "modules\mod_yt_k2_slideshowii\assets\yt_k2slideshowii.php", finding:

	function forImage( &$item ){
		
			$content =  $item->introtext;
			$content .=  $item->fulltext;
						
			$item  = yt_k2slideshowii::k2Image( $item );
			
			if( $item->main_image != '' ){
				
				return $item;
			}
			
			preg_match ( "#<img.+src\s*=\s*\"([^\"]*)\"[^\>]*\>#iU" , $content, $matches); 
			$images = (count($matches)) ? $matches : array();
			if (count($images)){				
				$item->main_image = $images[1];
			} else {				
				$row->main_image = '';	
			}
			
		}



change to

function forImage( &$item ){
		
			$item  = yt_k2slideshowii::k2Image( $item );
			
			if( $item->main_image != '' ){
				
				return $item;
			}		
			
		}


Thanks
Ticket System | Join our Clubs to download our extensions and templates
The following user(s) said Thank You: CSN2011
  • Page:
  • 1
Time to create page: 0.26 seconds

Notification

Please find your issue via Suggested Posts before submitting your question. We have solved the most of issues and maybe your issue was solved before.

Latest My Topics

No posts to display.

Love all our templates?

Join our membership clubs starting at $49 only for access to all of our templates

Join Now
Home Pricing
Your Cart is currently empty!
Product update
Coupon
add
Coupon code invalid! Please re-enter!
AJAX loader
SearchSupport
Magento Themes Magento Extensions Free Magento Extensions Prestashop Themes Prestashop Modules Magento 2 Themes