Facebook LinkedIn
  • Home
  • Pay Invoice
  • Service Plans
  • Contact Us
  • Learn More
    • Candyweb.US and You
    • SEO and Marketing
  • FAQ
  • Tech Blog
  • Portfolio

Candyweb.us Tech Blog

Joomla 2.5 Strips img usemap Attribute

Details
Last Updated: Thursday, 03 May 2018 19:19
Hits: 2313

So I ran into a problem today. Working with an article that has mapped images, I found that the usemap attribute was being stripped out of the img tag by the editor TinyMCE.

I tried to use the parameters in the TinyMCE plugin to solve the problem, and that did work partially, but it also broke a lot of the other TinyMCE functionality. There is a parameter in the TinyMCE Plugin options for Extended Valid Elements. The online documentation I found told me to put something like this in there:

img[class|src|usemap|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]

Well I tried several variations on this. While it DID keep the editor from stripping out the usemap attribute, thus allowing my mapped images to work again, it also caused other problems with the editor itself, such as not showing the images in the article when in editor view.

Then I came across another helpful hint online, suggesting an edit to the /plugins/editors/tinymce.php file. Starting at line 415 (in TinyMCE version 3.5.1) is this code:

// advimage
$advimage = $this->params->def('advimage', 1);
if ($advimage)
{
	$plugins[]	= 'advimage';
	$elements[]	= "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|style]';
}

As suggested, I added in the usemap attribute after the style attribute, making it look like this:

// advimage
$advimage = $this->params->def('advimage', 1);
if ($advimage)
{
	$plugins[]	= 'advimage';
	$elements[]	= 'img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|style|usemap]';
}

And now, my editor is working perfectly, AND not stripping out the usemap attribute. I'm happy, and so is my client! The only problem is, that I had to hack this file, and wasn't able to use the override system. So when the TinyMCE editor is updated next time, I will have to make this change again. Aah well. Until next time!

green-apple.jpg

Contact Candyweb.us
Huntsville, Arkansas
Call us: 479-981-2784
chewy_fruit.jpg
Site Design by Candyweb.us   Copyright © 2009-2020.   All Rights Reserved.