Reputation: 17
i want to make a content plugin in Joomla, in which whenever i insert image it automatically converts into popup.
for this i will use Jcemediapopup, it uses class="jcemediapopup"
i now just simply wants, whenever user insert image in article, with the help of our plugin that <img src
line coverts into like this <img class="jcemediapopup" src=
so that all image become Popup.
Any help !
Upvotes: 0
Views: 505
Reputation: 4509
unless you want to write a plugin for this, you can do it in a template override, eg. to apply this to e content article:
change
<?php echo $this->item->text; ?>
to something like
<?php echo preg_replace('/<img src="([^"]+)" ([^>]*)>/',
'<a href="\1"><img src="\1" class="jcemediapopup" \2></a>',$this->item->text); ?>
You might have to tweak the regexp if the images already contain a class-tag ...
Upvotes: 1