Giter Club home page Giter Club logo

tinymce-uploadimage's Introduction

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

tinymce-uploadimage's People

Contributors

francoisjacquet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.