MyBB Community Forums

Full Version: Mybb İmage Size No Plugin Mycode!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Mybb İmage Size No Plugin Mycode

Theme Style /Global.css/Advanced mode
#maximage 
{
max-width: 255px;
}


After Add MyCode


İmage Size Mycode

Title: maximage
Short Description: Mybb Max İmage No Plugin
Regular Expression:
\[img\](.*?)\[/img\]
Replacement:
<img onclick="javascript:window.location='$1';" src="$1" alt="İmage" id="maximage" title="Click Photo To Enlarge">
Enabled? : Yes

Demo: Demo İmage Size
Useful and good but is there a way you can open the image on a lightbox or a pop-up window?
I just wanted to say thanks, this worked perfectly for me.
(2010-06-11, 10:33 AM)E-Hero Kyle Wrote: [ -> ]Useful and good but is there a way you can open the image on a lightbox or a pop-up window?

Install fancyzoom. Than follow Bycca guide but for Replacement: use this instead.

<a href="$1" class=\"fancyzoom\"><img src="$1" alt="İmage" id="maximage" title="Click Photo To Enlarge"></a>

This should also work with lightbox, just remove fancyzoom and replace it with lightbox.
I see you are using the ID tag for styling (id="imagesize"), instead of using CLASS (class="imagesize").

You do know that validation standards dictates you can only display an ID style tag once on any page, otherwise it will fail W3C validation. Try posting one or two or more images using the IMG tag in a post to see what I mean, then run that page through W3C validation service.

Use the CLASS (class="imagesize") instead, and add this to your CSS below.

.maximage {
max-width: 255px;
}

You can display a CLASS more than once on a page and it will still pass validation standards, unlike an ID. There should also be a backslash included in the IMG code to pass validation "/>".

Use this below instead.

<img onclick="javascript:window.location='$1';" src="$1" class="maximage" alt="İmage" title="Image" />

All that aside, very nice MyCode indeed. Much better than having to use a plug-in to resize external images in posts using the IMG tag, which if large would break your forum layout. I'm using it myself now.
(2011-02-13, 04:22 PM)Gary Bolton Wrote: [ -> ]I see you are using the ID tag for styling (id="imagesize"), instead of using CLASS (class="imagesize").



Thanks for this, is there away when you click on image
to stay in same url in forum and just only show the image bigger
Sorry for my English
I found out this will not work right with IE browsers, it has no effect. Unless you also add "max-height" to css code.

.maximage {
max-width: 640px;
max-height: 480px;
}
You don't need to specify the protocol "javascript:" for the onclick attribute. The value of the title normally shows up as a popup balloon when the mouse hovers over the element, so you probably want to omit it.

<img onclick="window.location='$1';" src="$1" class="maximage" alt="İmage" />
Ok thanks for the answers. I will try these
and see what happens

Big Grin
Many many thanks Bycca and Gary this mycode is great and is much better than having a plug-in to resize images !!
Pages: 1 2 3