Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.


Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Strange behaviour inserting images in CMS


4 Posts   1173 Views


12 June 2008 at 3:49am (Last edited: 12 June 2008 3:53am), Community Member, 52 Posts

Hi all:

I´m using SS 2.2.1
If I add images to a page in CMS with Firefox there is not problem.
But if i add images to a page in CMS with IE, there is an XML error in the resulting page(we can see it, opening the page with Firefox. See ErrorXML_1.jpg).

As you can see in ErrorXML_2.jpg, the error is produced because the editor inserts strange JavaScript code.

Someone has the same problem?

thanks in advance.


17 June 2008 at 9:58pm Community Member, 52 Posts

Hi all:

I have discovered that the code that creates the problem is in jsparty/tiny_mce_improvements.js, concretely in onmouseup function.
The content in this function is inserted in the HTML. I can´t find when is inserted.
If I delete the function, it works better (no XML error in Firefox), but i have discovered that TinyMCE adds this chunk code to the image:

resizeTo="function(width, height) {       var newWidth = parseInt(height);       var newHeight = parseInt(height) - this.heightDiff;       if(isNaN(newWidth)) newWidth = this.width;       if(isNaN(newHeight)) newHeight = this.height;              // Constrain to width of the window       if((this.offsetLeft + this.offsetWidth + 20) > this.ownerDoc().offsetWidth)          newWidth += (this.ownerDoc().offsetWidth - this.offsetLeft - this.offsetWidth - 20);           if(this.aspectRatio) {          // Figure out which dimension we have altered more          var heightChange = this.originalHeight / this.height;          if(heightChange < 1) heightChange = 1/heightChange;                    var widthChange = this.originalWidth / this.width;          if(widthChange < 1) widthChange = 1/widthChange;                    // Scale by the more constant dimension (so if you edit the height, change width to suit)          if(widthChange > heightChange)             newHeight = newWidth * this.aspectRatio;          else             newWidth = newHeight / this.aspectRatio;       } = newWidth + 'px'; = newHeight + 'px';       this.width = newWidth;       this.height = newHeight;                 // Auto-size special image holders       if(this.parentNode.parentNode.className.match(/(^|\b)specialImage($|\b)/)) { = newWidth + 'px';       }    }" ownerDoc="function() {       var f =this.parentNode;       while(f && f.tagName.toLowerCase() != 'body') f = f.parentNode;       return f;    }" prepareForResize="function() {       if(this.aspectRatio == null) {          this.aspectRatio = this.height / this.width;       }           this.originalWidth = this.width;       this.originalHeight = this.height;    }" _onclick="function() {       var form = $('Form_EditorToolbarImageForm');       if(form) {          form.elements.AltText.value = this.alt;          form.elements.CSSClass.value = this.className;       }    }" initialize="function() {       TinyMCE.prototype.addEvent(this, 'click', this._onclick);    }"

I also have discovered that the image is moved to assets/imagenes/_resampled/ResizedImage545161-img.jpg directory and i don´t understand why because i have used the image without resizing.
Any idea about avoiding to resizing images in SS?


20 June 2008 at 11:07am Forum Moderator, 801 Posts

hm, i can't find this javascript code anywhere - the tiny_mce_improvements has similiar javascript, but not in the resizeTo="function()..." notation. where did you find this code?
there's most likely a curly brace too many, do you get a javascript error as well?


20 June 2008 at 7:39pm Community Member, 52 Posts

Hi Ingo:

Thank you very much for analizing this problem.
The code inserted is in tiny_mce_improvements.js file.
The resizeTo code is in the resizeTo: function the ownerDoc is in ownerDoc: function and so on.
I don´t know how to debug to know where TiniMCE decides to insert this or not. By the way i have to say that saving the same content this chunk of code is not always inserted :-(