MyBB Community Forums
Mybb İmage Size No Plugin Mycode! - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Resources (https://community.mybb.com/forum-8.html)
+--- Forum: MyCodes (https://community.mybb.com/forum-117.html)
+--- Thread: Mybb İmage Size No Plugin Mycode! (/thread-71394.html)

Pages: 1 2 3


Mybb İmage Size No Plugin Mycode! - Bycca - 2010-06-11

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


RE: Mybb İmage Size No Plugin Mycode! - E-Hero Kyle - 2010-06-11

Useful and good but is there a way you can open the image on a lightbox or a pop-up window?


RE: Mybb İmage Size No Plugin Mycode! - terrymason - 2011-01-17

I just wanted to say thanks, this worked perfectly for me.


RE: Mybb İmage Size No Plugin Mycode! - pinguy - 2011-02-05

(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.


RE: Mybb İmage Size No Plugin Mycode! - Gary Bolton - 2011-02-13

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.


RE: Mybb İmage Size No Plugin Mycode! - Greko - 2011-02-27

(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


RE: Mybb İmage Size No Plugin Mycode! - Gary Bolton - 2011-02-28

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;
}


RE: Mybb İmage Size No Plugin Mycode! - laie_techie - 2011-02-28

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" />



RE: Mybb İmage Size No Plugin Mycode! - Greko - 2011-02-28

Ok thanks for the answers. I will try these
and see what happens

Big Grin


RE: Mybb İmage Size No Plugin Mycode! - User 26345 - 2011-02-28

Many many thanks Bycca and Gary this mycode is great and is much better than having a plug-in to resize images !!