Adding template overridable images in your extension
From Joomla! Documentation
If you want to use images in your extension and you want to offer Joomla site administrators the option to customize it (via the template), this is the way to do it. Administrators or (template) designers will then be able to override your images via the template (images folder).
Wherever you need the image (in html), use this code:
echo JHTML::_('image.site', 'myimage.png','/plugins/content/mypluginfolder/');
- This means that:
- IF there is a template myimage.png found back at "[template folder]/images", use this one
- IF NOT use the one in "/images/M_images".
- This is for front end images, for back-end images replace "image.site" with "image.administrator".
- Don't forget to insert the image in your extension's zip package and in the XML configuration file.
- If you don't specify a folder, the folder "/images/M_images" will be initially searched for in the front-end, "/images" in the back-end.
- If you want to know more: JHTMLImage is the class called by this JHTM.
Based on this forum topic: JHTML image.site; Where to put the fail back images ?