I don't see the need of such a plugin. You can insert a single image much easier with the editor. What more the plugin will do for you? Add a caption text? You can also do that with the editor. If you want to mimic Elxis style add a div around your image and a caption text like that:<div class="elx_content_imagebox"> <img src="..." alt="my picture" /> <div>Image description</div></div>
Maybe a module which displays the top tags will be useful.
{nameplugin}path/to/image.png{/nameplugin}
<img src="http://www.example.com/path/to/image.png" />
I still believe you think wrong.You tell that you want to insert something like that:Code: [Select]{nameplugin}path/to/image.png{/nameplugin}Then why don't you insert directly the image? Why to mess with a plugin where you can simply use html??? Don't make things complicated when they are simple.Code: [Select]<img src="http://www.example.com/path/to/image.png" />A tags module is a good proposal and Elxis tag pages have been approved great for SEO. I will build that.
Although I don't agree pasting from word I now see the need for the plugin for your case. You hadn't explained the situation in details before. OK then. A plugin for inserting images with their relative paths and optional caption. Format simple as this: {image}relative/path/to/image.jpg,Optional caption{/image}You need to have options for image width/height, align, view in lightview window, responsive width, anything?
You need to have options for image width/height, align, view in lightview window, responsive width, anything?
public function process(&$row, $published, $params) { $regex = "#{imatge}(.*?){/imatge}#s"; if (!$published) { $row->text = preg_replace($regex, '', $row->text); return true; } $matches = array(); preg_match_all($regex, $row->text, $matches, PREG_PATTERN_ORDER); if (!$matches) { return true; } $ePlugin = eFactory::getPlugin(); foreach ($matches[0] as $i => $match) { $contents = $matches[1][$i]; if ($contents == '') { $html = '<div class="elx_warning">falta link imatge</div>'; } else { $html = '<div style="text-align: center;"><img alt="" src="'.$contents.'" /></div>'; } $row->text = preg_replace("#".$match."#", $html, $row->text); } return true;}
$regex = "#{image\s*(.*?)}(.*?){/image}#s"; if (!$published) { $row->text = preg_replace($regex, '', $row->text); return true; } $this->prepareclasses($params); $matches = array(); preg_match_all($regex, $row->text, $matches, PREG_PATTERN_ORDER); if (!$matches) { return true; } $ePlugin = eFactory::getPlugin(); foreach ($matches[0] as $i => $match) { $attributes = $ePlugin->parseAttributes($matches[1][$i]); $this->alt_text= ''; if (isset($attributes['alt_text']) && ($attributes['alt_text'] != '')) { $this->alt_text= $attributes['alt_text']; } $this->caption= ''; if (isset($attributes['caption']) && ($attributes['caption'] != '')) { $this->caption= $attributes['caption']; } $this->float= ''; if (isset($attributes['float']) && ($attributes['float'] != '')) { $this->float= $attributes['height']; } }