TinyMCE remove-base-64-image

TinyMCE remove-base-64-image Install Statistics

0
100%
Today: 0 Yesterday: 0 All-time: 1,379 downloads
TinyMCE remove-base-64-image Icon

Try plugin: TinyMCE remove-base-64-image

We'll create fresh WordPress site with TinyMCE remove-base-64-image installed. You have 20 minutes to test the plugin after that site we'll be deleted.

Takes ~10 seconds to install.

About TinyMCE remove-base-64-image

"TinyMCE remove-base-64-image" immediately removes images dropped into the TinyMCE editor with Firefox and alerts the user with the reason.

0


0


0


0


0

updated: 11 years ago
since: 11 years ago
author: Jon Collier

Description

Firefox allows a user to drag and drop an image from their desktop into the TinyMCE editor (Visual), where it is immediately converted to base64 code, which is undesirable as the image file size is much larger than the equivalent added by the standard WordPress method because…

  • base64 images are larger than binary images
  • WordPress would normally have ‘crunched’ the image to give various different sizes, including a thumbnail, all smaller than the original

To prevent this, “TinyMCE remove-base-64-image” contains a small piece of javascript that checks the TinyMCE editor every 1.5 seconds and immediately removes any base64 image found, also displaying an alert message:

‘Sorry, dragging images into the editor is blocked as it will cause your webpages to load slowly, please use the “Add Media” button!’.

If you manage multiple WordPress sites this plugin will save you time checking if your clients are unwittingly crippling their page downloads.

A PixelTiger plugin.

Developer Notes

I am aware that using setInterval to detect a freshly dropped image is not ideal from a theoretical standpoint as most of the time it’s unnecessary and it could impact TinyMCE performance, albeit by a tiny amount. If you check the TinyMCE forums you will find another suggested method: Disable drag/drop facility (last post by Arvind, 2012-07-09) which involves modifying tiny_mce.js to detect the DOMNodeInserted event then deleting the new image node. While this seems sound, if you try to locate the ‘_addEvents function section’ mentioned you’ll find it’s not in tiny_mce.js version 3.5.8-wp. I also searched the TinyMCE documentation for a way to bind this event in a plugin, but no joy there either.

So if you’re a javascript genius feel free to make this plugin redundant with a DOM checking one. Until that time arrives I hope people find this useful.