Download the PHP package marrouchi/upload-crop-image-bundle without Composer
On this page you can find all versions of the php package marrouchi/upload-crop-image-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download marrouchi/upload-crop-image-bundle
More information about marrouchi/upload-crop-image-bundle
Files in marrouchi/upload-crop-image-bundle
Package upload-crop-image-bundle
Short Description Basic server side cropping behavior for Symfony2
License MIT
Homepage https://github.com/anis-marrouchi/UploadCropImageBundle
Informations about the package upload-crop-image-bundle
UploadCropImageBundle
Upload and crop an image for Symfony2 This bundle helps you add a custom file form field. You can single upload and crop an image. The bundle is based on the JCrop JQuery library. Your contribution is welcome.
Requirements:
- PHP GD2 extension
- JQuery
- friendsofsymfony/jsrouting-bundle
Demo:
Installation
-
Add this bundle to your project in composer.json:
- Register UploadCropImageBundle in your app/AppKernel.php:
And don't forget the JsRoutingBundle.
-
Add Media entity, run schema update to generate table, and install assets (Composer should install asset post the installation but just in case)
-
Include the route to your routing.yml and the config to your config.yml:
If you did not install the JSroutingBundle include them.
-
include the style and the javascript in your templates. The demo include is for demo purposes.
-
Include the javascript before the closing body tag
-
Add the following to your Media/Image/Photo form type buildForm method
-
Now in your view, where you are rendering the form, include the following
- Now add the form tag the coordinate checker and render your file field like so. You can pass the route for upload thru the html data attributes. supported data attributes are data-route, the route you will handle the upload and the data-id attributes used to handle any extra route id parameter.
If you are rendering the form fields individually, you will need to include the following to your form
And that's it, let me know if you are facing some problem and let me know ways i can improve the bundle. Enjoy! ;)
All versions of upload-crop-image-bundle with dependencies
ext-gd Version *
symfony/framework-bundle Version ~2.3
friendsofsymfony/jsrouting-bundle Version *