Page 1 of 1

RandomImage - id added

Posted: Sun Mar 19, 2006 3:47 pm
by Greg
I added the following code at line 59 of function.random_image.php to give the image tag an id to be used with CSS. Works really well with ideas such as this at Stu Nicholls site.

Code: Select all

	#Check if user has specified id-tag
	if (isset($params['id']))
	{
		$id = ' id="'.$params['id'].'"';
	} else {
		$id = '';
	}
The return Line (approx line 98) also needs to be altered to:

Code: Select all

	return '<img'.$id.' src="'.$img.'"'.$alt.$align.$width.$height.' />';

Re: RandomImage - id added

Posted: Tue May 02, 2006 7:35 pm
by baconburgare
Aha, so I should add this to the code then? Could you please briefly explain what the id-tag does. I'm not quite familiar on how to use it, or why :)

Re: RandomImage - id added

Posted: Wed May 03, 2006 12:54 am
by Greg
It gives the img tag an id that can be then used for styling, positioning etc. with css.

Re: RandomImage - id added

Posted: Thu May 11, 2006 12:14 pm
by baconburgare
New version with id-tag released. Thx Greg!

http://dev.cmsmadesimple.org/frs/?group_id=124

Also fixed a bug where the same image was show in all tags when used several times on the same page. And fixed the IMG-tag so it validates to the W3C-standard.

Enjoy!  :D

Re: RandomImage - id added

Posted: Thu May 11, 2006 12:46 pm
by cyberman
baconburgare wrote: And fixed the IMG-tag so it validates to the W3C-standard.
Sounds like my bug report  ;D - thank you very much!

Re: RandomImage - id added

Posted: Thu May 11, 2006 12:48 pm
by Greg
Thanks baconburgare :)