MyBB Community Forums

Full Version: php image
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
how do you make the
[img]blabla.php[/img]
work, i've been told that i need to mod to get this to work
It's a forum setting (Admin CP --> Manage Forums --> Edit your forum --> Allow [ img ] code)

[ img ]http://www.dennistt.net/fimgs/avatar.php[/ img ] (spaces in the bbcode to make it show the code and not the image)
I believe it works here: [Image: avatar.php]

Make sure you include the whole url including http:// (eg. http://www.dennistt.net/fimgs/avatar.php, and not just fimgs/avatar.php)
That's pretty cool, converting .gif's to .php.
testing:
[Image: sig.php]

doesn't work Sad

is there something special i have to do to the php to make it work?
the image/php: http://www.ace-magic.com/images/sig/sig.php

the php source
<?php
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
?>
<img src="ie.jpg" border="0">
<?php
} else {
?>
<img src="ff.png" border="0">
<?php
}
?> 

help?

edit: and yes i do have the img code enabled
supersonicdarky Wrote:testing:
[Image: sig.php]

doesn't work Sad

is there something special i have to do to the php to make it work?
the image/php: http://www.ace-magic.com/images/sig/sig.php

the php source
<?php
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
?>
<img src="ie.jpg" border="0">
<?php
} else {
?>
<img src="ff.png" border="0">
<?php
}
?> 

help?

edit: and yes i do have the img code enabled

You can't use that code because it outputs HTML, and when you use [img] you must link to an image file, or a script that outputs an image, not HTML.
i'm new to php, so could someone code it for me? :/
You can try this, but I'm not sure if it will work 100%

if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
$file = "ie.jpg";
$mime = "image/jpg";
}
else {
$file = "ff.png";
$mime = "image/png";
}
$fp = fopen($file, "r");
$content = fread($fp, filesize($file));

header("Content-type: $mime");
echo $content;
sweet! it works Big Grin

thnx Smile
You're welcome. A +rep would be appreciated Wink