Foren / Cotonti / Support / [img] change size?

w1ckd
#1 26. Januar 2011, 05:12
Hi,
I searched the whole forum as far as the searchresults go but with a negative result.

When a user add a image in the forum he enters it by [img]
However these images are always wider then my forum, so i always have that scrollbar.
How could i change the [img] tag to a limited size ex" 500px width?

It should be something with bbcode right? or is there a plugin?

Thank you in advanced :)[/img][/img]
For our Freedom and Yours!
pieter
#2 26. Januar 2011, 14:53
Hi,

If you go to admin.php?m=bbcode
Search for [img]
In the column "Replacement" add inside the <img ...> a class:
eg class="resizeimage"

If got this:
<a href="$1"><img src="$2" alt="" class="resizeimage" /></a>

In css:
/*This is for Jquery*/
/* for understanding browsers */
.resizeimage   { max-width:250px;max-height:250px;}
/* for Internet Explorer */
/*\*/
* html .resizeimage{
border-width:1px solid #000000;
height: expression(this.height >= this.width && this.height > 250 ? '250px' : true);
width: expression(this.height < this.width && this.width > 250 ? '250px' : true);
}
[/img]
... can we help you ...
w1ckd
#3 26. Januar 2011, 18:26
Thank you very mutch pieter :)
For our Freedom and Yours!
pieter
#4 26. Januar 2011, 19:50
Can you change the topic title?
change
[img] in [ img ]

That's why my post and your first have a [ /img ] at the end.
... can we help you ...
GHengeveld
#5 26. Januar 2011, 22:31
That's an interesting bug. Best solution for the image resize problem is a piece of JavaScript that detects image sizes and downscales if necessary. I'm sure there's scripts like that available online.
pieter
#6 26. Januar 2011, 22:56
this is javascript, I forgot the headerpart:

	<script type="text/javascript"> 
		$(document).ready(function() {
			jQuery(function($) {
				$("a[href]").filter(function() {
					return /\.(jpg|png|gif)$/i.test(this.href);
				}).slimbox({}, null, function(el) {
					return (this == el) || (this.parentNode && (this.parentNode == el.parentNode));
				});
			});
			$(".scale").jScale({ls:"550px"})
 
		});
	</script> 
... can we help you ...
Kort
#7 26. Januar 2011, 23:01
Any lightbox clone can handle resize for images marked by a rel or class, which is easy using bbcodes.
SED.by - создание сайтов, разработка плагинов и тем для Котонти
ez
#8 27. Januar 2011, 16:04
You can also do it with hooks and tpls..
I have made solutions were image sizes are controlled by php and not by js...
==- I say: Keep it EZ -==