Download the PHP package teaocha/sonata-admin-image-panel without Composer

On this page you can find all versions of the php package teaocha/sonata-admin-image-panel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sonata-admin-image-panel

TeaochaSonataAdminImagePanel

Symfony2 bundle that adds a page and modal popup to the sonata admin that lets you upload, crop, and browse images

alt tag

How it works

Installing

First require the bundle:

Add it to your kernel

Install the assets:

Add the routing:

Tell sonata to use the bundle's layout:

Creating the request handler

Given that there are all sorts of ways you may want to store your or process your images I thought it best to leave the image handling up to you, so in order for the bundle to work you have to create a service that handles the requests.

Here's what it should look like:

Your service should implement the RequestHandler interface

There are then four functions for you to fill in:

imageUpload receives a base64 encoded data string (NOT including 'data:image/*;base64,'), and a content type (e.g. 'image/jpeg') which you should process in your own way and return a RequestResult object (see below)

imageUrlUpload receives a url from an external image. Again, do what you will with it and return a RequestResult object.

deleteImage receives an id that should refer to a record of an image previously uploaded. You don't need to return anything.

listImages is used to populate the image panel. It should return an array of RequestResult objects

RequestResult is a simple object that requires two fields to be set:

The 'preview url' is the url that will be used to show the image in the panel, and the 'id' should be a numeric id that refers to that image

Once you've done that, add the service and tag it with teaocha.image_panel.request_handler:

Adding a button to a text field

You can add a button to any text input in the admin that looks like so:

alt tag

Do this by adding a button with class teaocha-image-panel-url-btn to the help option of the admin field:

Using the bundle with CKEditor

The bundle includes the CKEditor standard edition in its assets. The editor is configured to use the image panel for browsing images. When you click the image icon on CKEditor's dashboard there will be a button next to the URL input which says 'Browse Server'; clicking that will open the panel.

The bundle's admin dashboard layout includes the necessary script tags to use the editor so all you have to do to get it to appear in an edit form is add the 'ckeditor' class to a form textarea (see example above).

If you are already using CKEditor and don't want to override your current settings you'll have to edit my layout file and remove the line which includes ckeditor. Then, to use the image panel, go into config.js of the editor and add the line:

Credits

Additional credits go to Cropper, because that's what i've used for image cropping

Notes

Right now the panel only uploads data strings in the jpeg format


All versions of sonata-admin-image-panel with dependencies

PHP Build Version
Package Version
Requires php Version ^5.3.9|^7.0
symfony/symfony Version ~2.8
sonata-project/core-bundle Version ^2.2.6
sonata-project/admin-bundle Version ~2.3,<2.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package teaocha/sonata-admin-image-panel contains the following files

Loading the files please wait ....