MyBB Community Forums

Full Version: [img] tag change help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi,
my current board is phpbb and i devised a mod to better display wide images. i need to incorporate that mod in mybb.

I have this code from the bbcode table inophobb that i need to replicate in mybb

<!-- BEGIN img --><div class="box" onClick="toggleOverflow(this);">	 
	 <img src="{URL}"></div>
<div align="left"><span class="style1">Single click on image to expand/contract where appropriate</span>
</div><!-- END img -->

can you please tell me where i can redefine the img tag to this.

thanks
The mycode_parse_img function in inc/class_parser.php
WOW !!

err, have you any idea how i include the above into that.

basically what it does (along with a css change and a script in the post template) is to create a hidden overflow area when an image is over a certain width. and when that image is clicked it opens up full and then clicked again the overflow is hidden again. I designed this so that large images wouldn't break the board tables.

but i have to admit i haven't a clue how to insert the tag code bit into mybb.
Find this:
		if($dimensions[0] > 0 && $dimensions[1] > 0)
		{
			return "<img src=\"{$url}\" width=\"{$dimensions[0]}\" height=\"{$dimensions[1]}\" border=\"0\" alt=\"\" />";
		}
		else
		{
			return "<img src=\"{$url}\" border=\"0\" alt=\"\" />";			
		}
And replace with
		if($dimensions[0] > 0 && $dimensions[1] > 0)
		{
			return "<!-- BEGIN img --><div class=\"box\" onClick=\"toggleOverflow(this);\">
<img src=\"{$url}\" width=\"{$dimensions[0]}\" height=\"{$dimensions[1]}\" border=\"0\" alt=\"\" /></div>
<div align=\"left\"><span class=\"style1\">Single click on image to expand/contract where appropriate</span>
</div><!-- END img -->";
		}
		else
		{
			return "<!-- BEGIN img --><div class=\"box\" onClick=\"toggleOverflow(this);\">
<img src=\"{$url}\" border=\"0\" alt=\"\" /></div>
<div align=\"left\"><span class=\"style1\">Single click on image to expand/contract where appropriate</span>
</div><!-- END img -->";			
		}
Untested code
unfortunately i get this dennis

Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /home/xxxxxx/public_html/forum/inc/class_parser.php on line 778

i have added the script part to postbit and the css components into the theme css.

this is the test code that works on an individual html page (although the image is no longer available)

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">

<html>

	<head>
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<title>Untitled Page</title>
		<style type="text/css" media="screen"><!--
.box {
	border: solid 1px #aaa;
	width: 900px;
	height: auto;
	overflow: hidden
	}

.fullbox {
	border: solid 1px #aaa;
	overflow: auto
	}

--></style>
		<script type="text/javascript"><!--
function toggleOverflow(obj) {
	obj.className = (obj.className != "fullbox") ? "fullbox" : "box";
}
//-->
</script>
	</head>

	<body bgcolor="#ffffff">
		<div class="box" onclick="toggleOverflow(this);"><img src="http://www.digitalimaging-uk.co.uk/filestore/files/1/Forum_Images/yellow_selective.jpg"></div>
	</body>

</html>
Can you upload your modified class_parser.php here
yep it's attached
dennis i fixed that.. mising a ';' from the end.

i now get

Fatal error: Call to undefined method postParser::mycode_auto_url() in /home/xxxxxx/public_html/forum/inc/class_parser.php on line 308

i redid all the changes from the start and now it woks mate,

i must have screwed it up with all the cutting and pasting.

thanks for your help once again
Yeh, you accidentally removed the end } from the function