I've modified urlfilter to create imagefilter. This will convert the address of any image (url of a file ending with jpg,jpeg,png,gif) into an inline img tag. This img will be surrounded by a div class "image" which you can modify in your css.

so effectively with this filter, all you have to insert an image into a node or comment, is to just paste the address of a picture, something like wiki if i'm not mistaken.

file:
imagefilter.module



function imagefilter_help($section) {
  switch ($section) {
    case 'admin/modules#description':
      return t("Automatically turns '.gif', '.jpg', '.jpeg' and '.png' addresses into inline images.");
  }
}


hope somebody finds this useful
function imagefilter_filter_tips($delta, $format, $long = false) {
  return t("'.gif', '.jpg', '.jpeg' and '.png' addresses automatically turn into inline images.");
}

function imagefilter_filter($op, $delta = 0, $format = -1, $text = '') {
  switch ($op) {
    case 'list':
      return array(0 => t("Image filter"));

    case 'description':
      return t("Automatically turns '.gif', '.jpg', '.jpeg' and '.png' addresses into inline images.");

    case 'process':
      $text = ' ' . $text . ' ';


      $HTMLbefore="<div class=image><img src='";
      $HTMLafter="'></div>";

      $text = preg_replace(
        '!(<p>|[ \n\r\t\(])([a-zA-Z0-9@:%_~#?&=.,/;-]*)\.(jpg|jpeg|gif|png)(</p>|[ \n\r\t\)])!i' ,
        " ".$HTMLbefore."$2.$3".$HTMLafter." " ,
        $text
      );

      $text = substr($text, 1, -1);

      return $text;

    default:
      return $text;
  }
}


Comments

patbranch’s picture

How would I use this?