Skip to content
This repository has been archived by the owner on Jul 5, 2018. It is now read-only.

francoisjacquet/tinymce-uploadimage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GitLab

RosarioSIS code is now hosted at GitLab!

UploadImage, a TinyMCE plugin

screenshot

https://github.com/francoisjacquet/tinymce-uploadimage

Version 0.1 - January, 2017

License GNU GPL v2

Author François Jacquet

This plugin allows users to upload images which are directly placed into the text area.

Technically speaking, the image is automatically converted to base64 code. No images are uploaded to the server. The image data is directly placed inside the src of the HTML image tag.

Requirements

This was written for TinyMCE version 4 (TinyMCE is a WYSIWYG HTML editor).

Setup

Your TinyMCE init() method should contain the following value:

tinymce.init({
	...
	plugins: 'uploadimage', // and your other plugins.
	toolbar: 'uploadimage'  // and your other buttons.
	...
});

To allow images drag-n-drop or pasting:

tinymce.init({
	...
	paste_data_images: true,
	images_upload_handler: function (blobInfo, success, failure) {
		success("data:" + blobInfo.blob().type + ";base64," + blobInfo.base64());
	},
	...
});

Limitations

base64 encoded images are larger than its couterpart file.

Browsers may have image size limitations (around 8.5Mb).

If saved to DB, you may end up storing lots of data...

Demo

You can test this plugin within RosarioSIS. Go to the demo site, login as administrator, then browse to Students > Print Letters.

Save base64 image to disk

RosarioSIS can automatically save base64 images to disk, thanks to this function which detects and extracts base64 images in the TinyMCE HTML; and this function which actually uploads the image to the server.

Credits

@boxuk for the original plugin, see https://github.com/boxuk/tinymce-imageupload

Releases

No releases published

Packages

No packages published