Uploading an image using Redactor
There are a few different JavaScript libraries that can turn a form's text area into a WYSIWYG editor. Redactor is a newer library but is very well coded and has gained quite a bit of popularity in a short amount of time. For this recipe, we'll apply Redactor to our Laravel form, and create routes to allow for image uploads through Redactor.
Getting ready
We need to download a copy of Redactor from https://github.com/dybskiy/redactor-js/tree/master/redactor. Download redactor.min.js
and save it to the public/js
directory. Download redactor.css
and save it to the public/css
directory.
How to do it...
To complete this recipe, follow these steps:
Create a route in our
routes.php
file to hold our form with theredactor
field:Route::get('redactor', function() { return View::make('redactor'); });
Create a view in our
app/views
directory and name it asredactor.php
:<!DOCTYPE html> <html> <head> <title>Laravel and Redactor<...