Title: TinyMCE remove-base-64-image
Author: LingoJon
Published: <strong>2013 年 3 月 22 日</strong>
Last modified: 2013 年 7 月 3 日

---

搜索插件

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://s.w.org/plugins/geopattern-icon/tinymce-remove-base-64-image.svg)

# TinyMCE remove-base-64-image

 作者：[LingoJon](https://profiles.wordpress.org/lingojon/)

[下载](https://downloads.wordpress.org/plugin/tinymce-remove-base-64-image.zip)

 * [详情](https://cn.wordpress.org/plugins/tinymce-remove-base-64-image/#description)
 * [评价](https://cn.wordpress.org/plugins/tinymce-remove-base-64-image/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/tinymce-remove-base-64-image/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/tinymce-remove-base-64-image/#developers)

 [支持](https://wordpress.org/support/plugin/tinymce-remove-base-64-image/)

## 描述

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](http://www.pixeltiger.co.uk/program.html) 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](http://www.TinyMCE.com/forum/viewtopic.php?id=5090)(
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.

## 屏幕截图

 * [[
 * This shows the javascript alert message produced by dropping an image into the
   TinyMCE editor. If you want to change it edit line 13 of /removeBase64/editor_plugin.
   js

## 安装

 1. Upload the folder `tinymce-remove-base64-image` to the `/wp-content/plugins/` directory
 2. Activate the plugin through the ‘Plugins’ menu in WordPress

## 常见问题

  Why does this plugin sometimes take more than 1.5 seconds to give an alert

“TinyMCE remove-base-64-image” can only remove an image and alert the user after
browser conversion of the image to base64 code has completed, and this takes longer
for large images.

  Why doesn’t this plugin work with my theme?

Make sure you have the following hook in your theme’s header.php file just before`
</head>`:

    ```
    <?php wp_head(); ?>
    ```

  Does this plugin have any javascript dependencies?

Only TinyMCE, the default WordPress editor.

## 评价

此插件暂无评价。

## 贡献者及开发者

「TinyMCE remove-base-64-image」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ LingoJon ](https://profiles.wordpress.org/lingojon/)

[帮助将「TinyMCE remove-base-64-image」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/tinymce-remove-base-64-image)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/tinymce-remove-base-64-image/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/tinymce-remove-base-64-image/)，
或通过[RSS](https://plugins.trac.wordpress.org/log/tinymce-remove-base-64-image/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/tinymce-remove-base-64-image/)。

## 更新日志

#### 1.0.2

Corrected folder name in path.

#### 1.0.1

Fixed broken path to editor_plugin.js caused by WP_PLUGIN_URL no longer working 
in WordPress 3.5.2. Now uses plugins_url(). Also simplified javascript to use setInterval
without unnecessary closure.

#### 1.0.0

First version released.

## 额外信息

 *  版本 **1.0.2**
 *  最后更新：**13 年前**
 *  活跃安装数量 **10+**
 *  WordPress 版本 ** 3.5.1 或更高版本 **
 *  已测试的最高版本为 **3.5.2**
 *  语言
 * [English (US)](https://wordpress.org/plugins/tinymce-remove-base-64-image/)
 * 标签
 * [base64](https://cn.wordpress.org/plugins/tags/base64/)[Firefox](https://cn.wordpress.org/plugins/tags/firefox/)
   [image](https://cn.wordpress.org/plugins/tags/image/)[tinyMCE](https://cn.wordpress.org/plugins/tags/tinymce/)
 *  [高级视图](https://cn.wordpress.org/plugins/tinymce-remove-base-64-image/advanced/)

## 评级

尚未提交反馈。

[Your review](https://wordpress.org/support/plugin/tinymce-remove-base-64-image/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/tinymce-remove-base-64-image/reviews/)

## 贡献者

 *   [ LingoJon ](https://profiles.wordpress.org/lingojon/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/tinymce-remove-base-64-image/)

## 捐助

您愿意支持这个插件的发展吗?

 [ 捐助此插件 ](http://www.pixeltiger.co.uk/plugins-public.html#donate)