A small Fundanemt Image filter
Kim Schulz, friday d. 1. september 2006
Today I got tired of not being able to having more than one image in my blog (it used the fundaNews module as backend), so I decided to create a small filter to fix this.
As with most filters, it consist of tow files (i have them placed in /fundanemt/modules/imageFilter/):
- index.php
- config.php
So lets get to the code:
My config.php looks like this:
$filter_function = "image_filter"; $filter_file = "index.php"; $filter_active = true;
and the index.php is even simpler:
function image_filter($str) <a href="http://<image src="]*)](.*)"([^ />" target="_top" class="normal" title="msiU", \'<image src="¤¤¤5¤¤¤"¤¤¤6¤¤¤ />\', &#036;str); <br> return &#036;str; <br>"> ) $str = preg_replace("</a>
So what you have now is simply a way of adding an image whereever you want an image by simply writing:
[ image PARAMS]IMAGEURL[/image] (extra space added infront of first "image" to prevent filter activation).
the PARAMS are all the parameters you want to have on your img html tag (e.g., alt="", align="right" border=0 etc.) and IMAGEURL is the full or relative url to the image your want to insert.
An example could be:
[ image alt="my House" width="100"]/some/image/myhouse.jpg[/image] which will turn into
It is simple but works nicely.
Permanent url: http://www.schulz.dk/en/blog/blogarchive/50
Want your own image next to your comment? Join Gravatar.com - it's free!