Hello there! Welcome to Youjoomla Support Forums

We are Web Development Company specializing in Joomla Templates , Joomla Extensions and WordPress Themes development . You are not able to see some forum threads due to your memberhip level. To unlock all forums and special customer support please take few moments to signup . If you are just searching for free joomla templates , or free joomla extension support simply head to our Free Joomla Support forums and open a new thread. Our moderators will help you as soon as possible. To spead up the response time please take few seconds and go over forum rules

Have fun!

Intro image replace by article image

02-23-2014, 11:06 AM
# 1 (permalink)

I am using template "Quality SOund" as is, and I have a problem with module YJ Module Engine.

I am using Joomla content, and not K2.

I indicated an intro image to be visible, so far so good, it works.

BUT as soon as I insert an image in the article, it is this one (and NOT the intro image) that appears in the module.

Could you kindly let me know where I need to go to correct this?

With many thanks,


Are you sure your are posting in product assigned forum?: Yes

What is your CMS version?: Joomla 2.5

MySQL Version: 5.x

PHP version: 5.x

Link to installation: Dominique Rey, compositrice

Have you edited any files? If yes tell us which ones.: No

Is this personal or client website?: Personal
02-24-2014, 09:34 AM
# 2 (permalink)
Hello PatG221.

The engine is checking if image exist inside the article. If the image is there it will take the image. Also the intro image is the image from your article.

As you can see here this is the only image inside your article and that image is the one that engine is pulling out.

Dominique Rey

Thank you.
Kindness costs the least, but is worth the most!
02-24-2014, 05:23 PM
# 3 (permalink)
Thank you for your reply.

I have specified a different intro image for this article (not the picture in the article text). This is possible, in much the same way as in k2.

I would like the engine to pick up the intro image only, irrelevant of the fact that there is an image in the text of the article or not.

Could you let me know where to edit the code for this?

Wth many thanks in advance,

02-25-2014, 09:07 AM
# 4 (permalink)
image in the article has the priority over the intro image

see mod_yjme/yjme/k2functions.php function k2_yjme_art_image

you might want to change that preg_match_all to look for specific class ,


PHP Code:

preg_match_all("#\<img class=\"introimage\"(.*)src\=\"(.*)\"#Ui" 
so if you have an image with class name introimage in article than article image wil take over otherwise the assigned intro image will be displayed
02-25-2014, 09:09 AM
# 5 (permalink)
looking at the code now I should have done reversed check , check if image is assigned , if not use article image
02-25-2014, 09:15 AM
# 6 (permalink)
Try this one, change that complete function to this

PHP Code:

function k2_yjme_art_image ($row)
$is_image JFile::exists(JPATH_SITE.DIRECTORY_SEPARATOR.'media'.DIRECTORY_SEPARATOR.'k2'.DIRECTORY_SEPARATOR.'items'.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.md5("Image".$row->id).'_'.$k2image_size .'.jpg');
$is_image ){
$img JURI::root().'media/k2/items/cache/'.md5("Image".$row->id).'_'.$k2image_size .'.jpg';
$img $images[2][0];

02-26-2014, 03:22 AM
# 7 (permalink)
Thank you very much for this, Neo.

But this is for K2... would you have the same thiong for Joomla content?

With huge anticipated thanks,

02-26-2014, 03:31 AM
# 8 (permalink)
Neo, I just saw the code in file jomfunctions.php, but it does not work: here it is


	 * Smart Image detection inside article. Searches in intro text and if not found, in full article text from Joomla 2.5 intro image and full image from params. Image within article has priority.
	 * @param object $row
	 * @return string - image path
		function yjme_art_image ($row)
			$version = new JVersion;
			if($version->RELEASE > 1.7){	
				$img_from_params 	= json_decode($row->images);
					$img_intro 			= $img_from_params->image_intro;
					$image_fulltext 	= $img_from_params->image_fulltext;
				$img       			= yjme_search_image ( $row->introtext );
				$img_full 			= yjme_search_image ( $row->fulltext );
				if( $img ) return $img;
				if( $img_full ) return $img_full;
				if( $img_intro ) return $img_intro;
				if( $image_fulltext ) return $image_fulltext;

				$img = yjme_search_image ( $row->introtext );
				if( $img ) return $img;
				$img = yjme_search_image ( $row->fulltext );
				return $img;			
		 * Searches for all images inside a text and returns the first one found
		 * @param string $text
		 * @return string
		function yjme_search_image ( $text )
			preg_match_all("#\<img(.*)src\=\"(.*)\"#Ui", $text, $mathes);		
			return isset($mathes[2][0]) ? $mathes[2][0] : '';			

Can you figure out why?

With many thanks again,

02-26-2014, 03:46 AM
# 9 (permalink)
OK, figured it out: the code does give text image priority - I hacked it in order to treat only the image defined as $img_intro, and it works.

Many thanks for your help, and for pointing me in the right direction!

With best regards,

Thread Tools
Display Modes

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

Members Login