2 /////////////////////////////////////////////////
3 // PukiWiki - Yet another WikiWikiWeb clone.
5 // $Id: img.inc.php,v 1.12 2004/08/23 11:41:57 henoheno Exp $
9 define('PLUGIN_IMG_CLEAR', "<div style=\"clear:both\"></div>\n");
11 // ²èÁü¤ò¥¤¥ó¥é¥¤¥óɽ¼¨
12 function plugin_img_convert()
14 $usage = "#img(): Usage: (URI-to-image[,right[,clear]])<br />\n";
15 $args = func_get_args();
17 // Check the 2nd argument first, for compatibility
18 $arg = isset($args[1]) ? strtoupper($args[1]) : '';
19 if ($arg == '' || $arg == 'L' || $arg == 'LEFT') {
21 } else if ($arg == 'R' || $arg == 'RIGHT') {
24 // Stop word-wrapping only (Ugly but compatible)
25 // Short usage: #img(,clear)
26 return PLUGIN_IMG_CLEAR;
29 $url = isset($args[0]) ? $args[0] : '';
30 if (! is_url($url) || ! preg_match('/\.(jpe?g|gif|png)$/i', $url))
33 $arg = isset($args[2]) ? strtoupper($args[2]) : '';
34 $clear = ($arg == 'C' || $arg == 'CLEAR') ? PLUGIN_IMG_CLEAR : '';
37 <div style="float:$align;padding:.5em 1.5em .5em 1.5em">
38 <img src="$url" alt="" />