You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+55-42Lines changed: 55 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,7 @@
1
-
Use branch master for compatibility with Syfony 2
2
-
------------
3
-
Use branch 1.3 for compatibility with Symfony 3
4
-
------------
5
-
Use 0.X releases for compatibility with bootstrap 2.x.
6
-
------------
7
-
Compatibility with bootstrap 2.X is no more maintained
8
-
------------
9
-
10
1
ComurImageBundle
11
-
============
2
+
================
3
+
4
+
## Introduction
12
5
13
6
Image upload / crop bundle for Symfony2
14
7
@@ -21,32 +14,51 @@ It uses beautiful [Jquery File Upload](http://blueimp.github.io/jQuery-File-Uplo
21
14
22
15
**New Since Version 0.2.0 !! you can also create sortable & croppable gallery widgets** without any specific configuration. It only needs an array typed property in your entity (and a text column in your database). See below for examples, screenshots and how to use it.
23
16
17
+
18
+
## Which version use
19
+
20
+
|v SF|v Bundle|
21
+
|---|---|
22
+
|2.x|1.x|
23
+
|3.x|2.x|
24
+
|4.x|2.x|
25
+
26
+
27
+
Use 0.X releases for compatibility with bootstrap 2.x.
28
+
------------
29
+
30
+
Compatibility with bootstrap 2.X is no more maintained
31
+
------------
32
+
33
+
I won't maintain Symfony 2 anymore, I will only merge PR on 1.2 branch for compatibility with SF2. If you need something you can always create a PR and I will merge it.
34
+
--------
35
+
24
36
Screen shots
25
37
------------
26
38
27
39
Here are some screen shots since i didn't have time to put a demo yet:
It's used to determine relative directory name to put cropped images (see above).
136
148
137
149
**Default value:** 'cropped'
138
150
139
-
###thumbs_dir###
151
+
###thumbs_dir###
140
152
141
153
It's used to determine relative directory name to put thumbnails (see above).
142
154
143
155
**Default value:** 'thumbnails'
144
156
145
-
###media_lib_thumb_size###
157
+
###media_lib_thumb_size###
146
158
147
159
It's used to determine thumbnails size in pixels (squares) used in media library.
148
160
149
161
**Default value:** 150
150
162
151
-
###upload_dir###
163
+
###upload_dir###
152
164
153
165
Dirname of your public directory. It's used to check thumb existence in thumb twig helper.
154
166
155
167
**Default value:** 'web'
156
168
157
-
###translation_domain###
169
+
###translation_domain###
158
170
159
171
Domain name for translations. For instance two languages are provided (en & fr). To override the domain name, change this parameter to whatever you want.
160
172
161
173
**Default value:** 'ComurImageBundle'
162
174
163
-
###gallery_thumb_size###
175
+
###gallery_thumb_size###
164
176
165
177
That's the image size in pixels that you want to show in gallery widget. Gallery widget will automaticaly create square thums having this size and show them in the gallery widget.
166
178
167
179
**Default value:** 150
168
180
169
-
###gallery_dir###
181
+
###gallery_dir###
170
182
171
183
That's the gallery directory name. The widget will store all gallery images in a specific directory inside the root directory that you will give when you will add the widget to your forms.
172
184
173
185
**For eg.** if you put 'uploads/images' as webDir when you add the widget, gallery images will be stored in 'uploads/images/*[gallery_dir]*'. This is added to make gallery use easier so you don't have to add new functions to your entities to get gallery dirs.
174
186
175
-
#Usage#
187
+
#Usage#
176
188
177
189
178
190
There are two widgets provided with this bundle. They both have exacly same config parameters.
@@ -319,15 +331,15 @@ That's all ! This will create a widget like on the following image when you will
319
331
320
332
Gallery images will be stored in uploadUrl / gallery_dir (default is gallery). Cropped images will be stored in uploadUrl / gallery_dir / cropped_dir (same as image widget) and thumbs in uploadUrl / gallery_dir / cropped_dir / thumb_dir with specified width. So if you pu
321
333
322
-
##uploadConfig##
334
+
##uploadConfig##
323
335
324
-
###uploadRoute (optional)###
336
+
###uploadRoute (optional)###
325
337
326
338
Route called to send uploaded file. It's recommended to not change this parameter except if you know exactly what you do.
327
339
328
340
**Default value:** comur_api_upload
329
341
330
-
###uploadUrl (required)###
342
+
###uploadUrl (required)###
331
343
332
344
Absolute url to directory where put uploaded image. I recommend you to create a function in your entity and call it like it's showen in the example:
333
345
@@ -353,79 +365,79 @@ Absolute url to directory where put uploaded image. I recommend you to create a
353
365
}
354
366
355
367
356
-
###webDir (required)###
368
+
###webDir (required)###
357
369
358
370
Url used to show your image in templates, must be relative url. If you created related functions as explained in uploadUrl section, then you can user getWebPath() function for webDir parameter.
359
371
360
-
###fileExt (optional)###
372
+
###fileExt (optional)###
361
373
362
374
Permitted image extensions.
363
375
364
376
**Default value:** '*.jpg;*.gif;*.png;*.jpeg'
365
377
366
-
###libraryDir (optional)###
378
+
###libraryDir (optional)###
367
379
368
380
Directory to look into for images to show in image library.
369
381
370
382
**Default value:** uploadUrl
371
383
372
-
###libraryRoute (optional)###
384
+
###libraryRoute (optional)###
373
385
374
386
Route called to get images to show in library. I recommend you to not change this parameter if you don't know exactly what it does.
375
387
376
388
**Default value:** comur_api_image_library
377
389
378
-
###showLibrary (optional)###
390
+
###showLibrary (optional)###
379
391
380
392
Set this to false if you don't want the user see existing images in libraryDir.
381
393
382
394
**Default value:** true
383
395
384
-
###saveOriginal (optional)###
396
+
###saveOriginal (optional)###
385
397
386
398
Use this parameter if you want to save original file's path (for eg. to show big image in a lightbox). You have to put property name of your entity and the bundle will use it to save original file path in it.
387
399
388
400
**Attention:** This parameter is disabled for gallery for instance. It will be implemented soon.
389
401
390
402
**Default value:** false
391
403
392
-
###generateFilename (optional)###
404
+
###generateFilename (optional)###
393
405
394
406
This parameter is used to generate an uniq file name. Setted to false, it will keep the original filename.
395
407
396
408
**Default value:** true
397
409
398
-
##cropConfig##
410
+
##cropConfig##
399
411
400
-
###minWidth (optional)###
412
+
###minWidth (optional)###
401
413
402
414
Minimum with of desired image.
403
415
404
416
**Default value:** 1
405
417
406
-
###minHeight (optional)###
418
+
###minHeight (optional)###
407
419
408
420
Minimum height of desired image.
409
421
410
422
**Default value:** 1
411
-
###aspectRatio (optional)###
423
+
###aspectRatio (optional)###
412
424
413
425
True to aspect ratio of crop screen.
414
426
415
427
**Default value:** true
416
428
417
-
###cropRoute (optional)###
429
+
###cropRoute (optional)###
418
430
419
431
Route to crop action. I recommend you to not change this parameter if you don't know exactly what it does.
420
432
421
433
**Default value:** comur_api_crop
422
434
423
435
424
-
###forceResize (optional)###
436
+
###forceResize (optional)###
425
437
426
438
If true, system will resize image to fit minWidth and minHeight.
427
439
428
-
###thumbs (optional)###
440
+
###thumbs (optional)###
429
441
430
442
Array of thums to create automaticly. System will resize images to fit maxWidth and maxHeight. It will put them in "uploadDir/cropped_images_dir/thumbs_dir/widthxheight-originalfilename.extension" so you can use included Thumb Twig extension to get them, ex:
431
443
@@ -437,10 +449,11 @@ Array of thums to create automaticly. System will resize images to fit maxWidth
437
449
438
450
**New in 0.2.2:** You can use 'useAsFieldImage' option to use this thumb as image field's preview (in your form you will see this thumb instead of original cropped image). Usefull when you have big cropped images.
439
451
440
-
#TODO LIST#
452
+
#TODO LIST#
441
453
442
454
* Create tests
443
455
* Add more comments in the code
444
456
* Think about removed image deletion (for now images are not deleted, you have to care about it by yourself…)
445
457
* Update existing images list dynamicly after an image upload
0 commit comments