Giter Site home page Giter Site logo

martonbaranyai / ckeditor-imagebrowser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spantaleev/ckeditor-imagebrowser

0.0 2.0 0.0 1.27 MB

Image Browser plugin for CKEditor

Home Page: http://ckeditor.com/addon/imagebrowser

License: BSD 3-Clause "New" or "Revised" License

CSS 14.59% HTML 11.00% JavaScript 74.41%

ckeditor-imagebrowser's Introduction

CKEditor Image Browser plugin

imagebrowser is a CKEditor plugin that allows images on the server to be browsed and picked for inclusion into the editor's contents.

You can view the working demo HERE.

screenshot

This plugin integrates with the image plugin (part of CKEditor), by making it provide a Browse Server button in the Image dialog window.

The way you use it is very similar to imageGetJson in Redactor

  • you only need to provide a list of images in a JSON format, and the image browser will take care of the rest.

In fact, it uses the same data format as Redactor, allowing for an easy transition between the two editors.

Installation

Copy the whole contents of this repository into a new plugins/imagebrowser directory in your CKEditor install.

Make sure you're using the Standard or Full CKEditor packages. The Basic package lacks an in-built "File Browser" plugin, which this plugin depends on. You can also use a Custom CKEditor package, if you build it with "File Browser" plugin support.

Usage

Enable the plugin by adding it to extraPlugins and specify the imageBrowser_listUrl parameter:

<textarea id="my-textarea-id"></textarea>

<script type="text/javascript">
	CKEDITOR.replace('my-textarea-id', {
		"extraPlugins": "imagebrowser",
		"imageBrowser_listUrl": "/path/to/images_list.json"
	});
</script>

The imageBrowser_listUrl configuration parameter points to a URL that lists the server's images in a JSON format. Make sure to use an absolute path.

Example:

[
	{
		"image": "/image1_200x150.jpg",
		"thumb": "/image1_thumb.jpg",
		"folder": "Small"
	},
	{
		"image": "/image2_200x150.jpg",
		"thumb": "/image2_thumb.jpg",
		"folder": "Small"
	},

	{
		"image": "/image1_full.jpg",
		"thumb": "/image1_thumb.jpg",
		"folder": "Large"
	},
	{
		"image": "/image2_full.jpg",
		"thumb": "/image2_thumb.jpg",
		"folder": "Large"
	}
]

The above says that there are 2 image directories ("Small" and "Large") with 2 files in each of them.

  • image - the absolute path being used when the image gets put into the editor's contents.

  • thumb (optional) - the relative path to the image's thumbnail (for preview purposes). (if omitted, the value of image is used as a thumbnail.)

  • folder field is optional. If omitted, the image list will not be split into folders.

Another way to initiliaze

If you want the image browser plugin to work for all of your CKEditor textareas, you can edit CKEditor's config.js and add the 2 configuration lines:

config.extraPlugins = "imagebrowser";
config.imageBrowser_listUrl = "/path/to/images_list.json";

ckeditor-imagebrowser's People

Contributors

spantaleev avatar deant avatar beastafk avatar

Watchers

James Cloos avatar Marton Baranyai 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.