GithubHelp home page GithubHelp logo

uploadcare-tinymce's Introduction

Uploadcare TinyMCE Plugin

This is Uploadcare plugin for TinyMCE text editor. It will allow your users to upload files and images from local device, social networks, cloud storages without any backend code that is usually required to handle uploads.

Requirements

  • TinyMCE 4+

Install

Clone plugin from git to your plugins directory:

git clone git://github.com/uploadcare/uploadcare-tinymce.git plugins/uploadcare

Add the plugin and its button while initializing TinyMCE:

tinymce.init({
  ....
  plugins : ["uploadcare,..."],
  ....
  toolbar : "... | link image uploadcare"
  ....

Configuration

Find "config.js" file and add your settings there.

Required setting

There is only one - your public API key. You can get that by creating an account Uploadcare. You can use demo public key during dev stage, but note that demo account files are removed every few hours.

var UPLOADCARE_PUBLIC_KEY = "demopublickey";

Useful settings

Locale.

Set widget locale. Should be set as global variable:

<script>
    UPLOADCARE_LOCALE = 'es';
</script>

Crop.

You can enable custom crop in the widget. After a user selects a file she will be able to crop it, according to your settings. Original file will be uploaded to your project, but additional crop operations will be included in resulting image URL.

Crop options is a string with one or more crop presets. Presets are divided by commas. When more than one preset is defined, user can pick any of them on crop step. Each preset consists of a size definition and optional keyword.

  • "disabled" — crop is disabled. Can't be combined with other presets;
  • "" or "free" — crop enabled and the user will be able to select any area on an image;
  • "2:3" — user will be able to select an area with aspect ratio 2:3;
  • "300x200" — same as previous, but if the selected area is bigger than 300x200, it will be scaled down to these dimensions;
  • "300x200 upscale" — same as previous, but the selected area will be scaled even if it is smaller than the specified size;
  • "300x200 minimum" — user will not be able to select an area smaller than 300x200. If uploaded image is smaller than 300x200 itself, it will be upscaled.
<script type="text/javascript">
  UPLOADCARE_CROP = '4:3, 3:4';
</script>

Tabs (Upload Sources)

The widget can upload files from disk, URLs, and many social sites. Each upload source has its own tab in the widget dialog.

A full list of tabs supported in the latest widget version (2.10.2) is provided below.

Code File Source Default
file Local disk On
camera Local webcam On
url Any URL On
facebook Facebook On
gdrive Google Drive On
gphotos Google Photos On
dropbox Dropbox On
instagram Instagram On
evernote Evernote On
flickr Flickr On
skydrive OneDrive On
box Box Off
vk VK Off
huddle Huddle Off

The set can be reconfigured by specifying the ones you need in a space-separated value. Special value all can be used to enable all supported sources.

<script type="text/javascript">
  UPLOADCARE_TABS = 'file url instagram flickr';
</script>

Other settings

All Uploadcare widget settings are too numerous to be listed here, please read Uploadcare widget documentation to unleash full uploading power.

Usage

  1. Press "Uploadcare" button.
  2. Select a file to upload.
  3. An image or a file link will appear in editor

uploadcare-tinymce's People

Watchers

 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.