TinyMCE prevent image resizing

aspect-ratio, image, image-resizing, tinymce

Solution

I found a (partial) answer, so I thought I will share it here.

Adding

'object_resizing' : false

In the editor config prevents the resizing. Note that this is a feature of Mozilla only (e.g. Google Chrome does not allow you to resize the image).

I am still looking for a way of keeping `aspect ratio` in `real time`, but I do not know if that is really possible.

Problem

I am adding an image to a TinyMCE editor using: ``` var params = { src: filename, title: "Attached image: " + filename, width: 500 }; ed.execCommand("mceInsertContent", false, ed.dom.createHTML("img", params)); ``` This insert the image correctly in the editor. However, when the user clicks on the image he has the ability of resizing it. I would like to know if there is a way to: - Prevent the user to resize only in one direction (i.e. how do I keep a fixed aspect ratio for the image) - Completely prevent the user to resize the image

Original source