Media Datenbank 1.0

This commit is contained in:
Kevin Adametz 2019-11-21 21:12:17 +01:00
parent c11fc557bf
commit c9f3d85d4e
50 changed files with 4774 additions and 172 deletions

View file

@ -0,0 +1,9 @@
/*!
* Cropper v0.9.1
* https://github.com/fengyuanchen/cropper
*
* Copyright (c) 2014-2015 Fengyuan Chen and contributors
* Released under the MIT license
*
* Date: 2015-03-21T04:58:27.265Z
*/.cropper-container{position:relative;overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none}.cropper-container img{display:block;width:100%;min-width:0!important;max-width:none!important;height:100%;min-height:0!important;max-height:none!important;image-orientation:0deg!important}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal{position:absolute;top:0;right:0;bottom:0;left:0}.cropper-drag-box{background-color:#fff;filter:alpha(opacity=0);opacity:0}.cropper-modal{background-color:#000;filter:alpha(opacity=50);opacity:.5}.cropper-view-box{display:block;width:100%;height:100%;overflow:hidden;outline:#69f solid 1px;outline-color:rgba(102,153,255,.75)}.cropper-dashed{position:absolute;display:block;filter:alpha(opacity=50);border:0 dashed #fff;opacity:.5}.cropper-dashed.dashed-h{top:33.33333333%;left:0;width:100%;height:33.33333333%;border-top-width:1px;border-bottom-width:1px}.cropper-dashed.dashed-v{top:0;left:33.33333333%;width:33.33333333%;height:100%;border-right-width:1px;border-left-width:1px}.cropper-face,.cropper-line,.cropper-point{position:absolute;display:block;width:100%;height:100%;filter:alpha(opacity=10);opacity:.1}.cropper-face{top:0;left:0;cursor:move;background-color:#fff}.cropper-line{background-color:#69f}.cropper-line.line-e{top:0;right:-3px;width:5px;cursor:e-resize}.cropper-line.line-n{top:-3px;left:0;height:5px;cursor:n-resize}.cropper-line.line-w{top:0;left:-3px;width:5px;cursor:w-resize}.cropper-line.line-s{bottom:-3px;left:0;height:5px;cursor:s-resize}.cropper-point{width:5px;height:5px;background-color:#69f;filter:alpha(opacity=75);opacity:.75}.cropper-point.point-e{top:50%;right:-3px;margin-top:-3px;cursor:e-resize}.cropper-point.point-n{top:-3px;left:50%;margin-left:-3px;cursor:n-resize}.cropper-point.point-w{top:50%;left:-3px;margin-top:-3px;cursor:w-resize}.cropper-point.point-s{bottom:-3px;left:50%;margin-left:-3px;cursor:s-resize}.cropper-point.point-ne{top:-3px;right:-3px;cursor:ne-resize}.cropper-point.point-nw{top:-3px;left:-3px;cursor:nw-resize}.cropper-point.point-sw{bottom:-3px;left:-3px;cursor:sw-resize}.cropper-point.point-se{right:-3px;bottom:-3px;width:20px;height:20px;cursor:se-resize;filter:alpha(opacity=100);opacity:1}.cropper-point.point-se:before{position:absolute;right:-50%;bottom:-50%;display:block;width:200%;height:200%;content:" ";background-color:#69f;filter:alpha(opacity=0);opacity:0}@media (min-width:768px){.cropper-point.point-se{width:15px;height:15px}}@media (min-width:992px){.cropper-point.point-se{width:10px;height:10px}}@media (min-width:1200px){.cropper-point.point-se{width:5px;height:5px;filter:alpha(opacity=75);opacity:.75}}.cropper-bg{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-invisible{filter:alpha(opacity=0);opacity:0}.cropper-hide{position:fixed;top:0;left:0;z-index:-1;width:auto!important;min-width:0!important;max-width:none!important;height:auto!important;min-height:0!important;max-height:none!important;filter:alpha(opacity=0);opacity:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-canvas,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}

View file

@ -0,0 +1,304 @@
/*!
* Cropper.js v1.5.6
* https://fengyuanchen.github.io/cropperjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2019-10-04T04:33:44.164Z
*/
.cropper-container {
direction: ltr;
font-size: 0;
line-height: 0;
position: relative;
-ms-touch-action: none;
touch-action: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.cropper-container img {
display: block;
height: 100%;
image-orientation: 0deg;
max-height: none !important;
max-width: none !important;
min-height: 0 !important;
min-width: 0 !important;
width: 100%;
}
.cropper-wrap-box,
.cropper-canvas,
.cropper-drag-box,
.cropper-crop-box,
.cropper-modal {
bottom: 0;
left: 0;
position: absolute;
right: 0;
top: 0;
}
.cropper-wrap-box,
.cropper-canvas {
overflow: hidden;
}
.cropper-drag-box {
background-color: #fff;
opacity: 0;
}
.cropper-modal {
background-color: #000;
opacity: 0.5;
}
.cropper-view-box {
display: block;
height: 100%;
outline: 1px solid #39f;
outline-color: rgba(51, 153, 255, 0.75);
overflow: hidden;
width: 100%;
}
.cropper-dashed {
border: 0 dashed #eee;
display: block;
opacity: 0.5;
position: absolute;
}
.cropper-dashed.dashed-h {
border-bottom-width: 1px;
border-top-width: 1px;
height: calc(100% / 3);
left: 0;
top: calc(100% / 3);
width: 100%;
}
.cropper-dashed.dashed-v {
border-left-width: 1px;
border-right-width: 1px;
height: 100%;
left: calc(100% / 3);
top: 0;
width: calc(100% / 3);
}
.cropper-center {
display: block;
height: 0;
left: 50%;
opacity: 0.75;
position: absolute;
top: 50%;
width: 0;
}
.cropper-center::before,
.cropper-center::after {
background-color: #eee;
content: ' ';
display: block;
position: absolute;
}
.cropper-center::before {
height: 1px;
left: -3px;
top: 0;
width: 7px;
}
.cropper-center::after {
height: 7px;
left: 0;
top: -3px;
width: 1px;
}
.cropper-face,
.cropper-line,
.cropper-point {
display: block;
height: 100%;
opacity: 0.1;
position: absolute;
width: 100%;
}
.cropper-face {
background-color: #fff;
left: 0;
top: 0;
}
.cropper-line {
background-color: #39f;
}
.cropper-line.line-e {
cursor: ew-resize;
right: -3px;
top: 0;
width: 5px;
}
.cropper-line.line-n {
cursor: ns-resize;
height: 5px;
left: 0;
top: -3px;
}
.cropper-line.line-w {
cursor: ew-resize;
left: -3px;
top: 0;
width: 5px;
}
.cropper-line.line-s {
bottom: -3px;
cursor: ns-resize;
height: 5px;
left: 0;
}
.cropper-point {
background-color: #39f;
height: 5px;
opacity: 0.75;
width: 5px;
}
.cropper-point.point-e {
cursor: ew-resize;
margin-top: -3px;
right: -3px;
top: 50%;
}
.cropper-point.point-n {
cursor: ns-resize;
left: 50%;
margin-left: -3px;
top: -3px;
}
.cropper-point.point-w {
cursor: ew-resize;
left: -3px;
margin-top: -3px;
top: 50%;
}
.cropper-point.point-s {
bottom: -3px;
cursor: s-resize;
left: 50%;
margin-left: -3px;
}
.cropper-point.point-ne {
cursor: nesw-resize;
right: -3px;
top: -3px;
}
.cropper-point.point-nw {
cursor: nwse-resize;
left: -3px;
top: -3px;
}
.cropper-point.point-sw {
bottom: -3px;
cursor: nesw-resize;
left: -3px;
}
.cropper-point.point-se {
bottom: -3px;
cursor: nwse-resize;
height: 20px;
opacity: 1;
right: -3px;
width: 20px;
}
@media (min-width: 768px) {
.cropper-point.point-se {
height: 15px;
width: 15px;
}
}
@media (min-width: 992px) {
.cropper-point.point-se {
height: 10px;
width: 10px;
}
}
@media (min-width: 1200px) {
.cropper-point.point-se {
height: 5px;
opacity: 0.75;
width: 5px;
}
}
.cropper-point.point-se::before {
background-color: #39f;
bottom: -50%;
content: ' ';
display: block;
height: 200%;
opacity: 0;
position: absolute;
right: -50%;
width: 200%;
}
.cropper-invisible {
opacity: 0;
}
.cropper-bg {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC');
}
.cropper-hide {
display: block;
height: 0;
position: absolute;
width: 0;
}
.cropper-hidden {
display: none !important;
}
.cropper-move {
cursor: move;
}
.cropper-crop {
cursor: crosshair;
}
.cropper-disabled .cropper-drag-box,
.cropper-disabled .cropper-face,
.cropper-disabled .cropper-line,
.cropper-disabled .cropper-point {
cursor: not-allowed;
}

10
packages/iqcontent/laravel-filemanager/public/css/cropper.min.css vendored Executable file → Normal file
View file

@ -1,9 +1,9 @@
/*!
* Cropper v0.9.1
* https://github.com/fengyuanchen/cropper
* Cropper.js v1.5.6
* https://fengyuanchen.github.io/cropperjs
*
* Copyright (c) 2014-2015 Fengyuan Chen and contributors
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2015-03-21T04:58:27.265Z
*/.cropper-container{position:relative;overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none}.cropper-container img{display:block;width:100%;min-width:0!important;max-width:none!important;height:100%;min-height:0!important;max-height:none!important;image-orientation:0deg!important}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal{position:absolute;top:0;right:0;bottom:0;left:0}.cropper-drag-box{background-color:#fff;filter:alpha(opacity=0);opacity:0}.cropper-modal{background-color:#000;filter:alpha(opacity=50);opacity:.5}.cropper-view-box{display:block;width:100%;height:100%;overflow:hidden;outline:#69f solid 1px;outline-color:rgba(102,153,255,.75)}.cropper-dashed{position:absolute;display:block;filter:alpha(opacity=50);border:0 dashed #fff;opacity:.5}.cropper-dashed.dashed-h{top:33.33333333%;left:0;width:100%;height:33.33333333%;border-top-width:1px;border-bottom-width:1px}.cropper-dashed.dashed-v{top:0;left:33.33333333%;width:33.33333333%;height:100%;border-right-width:1px;border-left-width:1px}.cropper-face,.cropper-line,.cropper-point{position:absolute;display:block;width:100%;height:100%;filter:alpha(opacity=10);opacity:.1}.cropper-face{top:0;left:0;cursor:move;background-color:#fff}.cropper-line{background-color:#69f}.cropper-line.line-e{top:0;right:-3px;width:5px;cursor:e-resize}.cropper-line.line-n{top:-3px;left:0;height:5px;cursor:n-resize}.cropper-line.line-w{top:0;left:-3px;width:5px;cursor:w-resize}.cropper-line.line-s{bottom:-3px;left:0;height:5px;cursor:s-resize}.cropper-point{width:5px;height:5px;background-color:#69f;filter:alpha(opacity=75);opacity:.75}.cropper-point.point-e{top:50%;right:-3px;margin-top:-3px;cursor:e-resize}.cropper-point.point-n{top:-3px;left:50%;margin-left:-3px;cursor:n-resize}.cropper-point.point-w{top:50%;left:-3px;margin-top:-3px;cursor:w-resize}.cropper-point.point-s{bottom:-3px;left:50%;margin-left:-3px;cursor:s-resize}.cropper-point.point-ne{top:-3px;right:-3px;cursor:ne-resize}.cropper-point.point-nw{top:-3px;left:-3px;cursor:nw-resize}.cropper-point.point-sw{bottom:-3px;left:-3px;cursor:sw-resize}.cropper-point.point-se{right:-3px;bottom:-3px;width:20px;height:20px;cursor:se-resize;filter:alpha(opacity=100);opacity:1}.cropper-point.point-se:before{position:absolute;right:-50%;bottom:-50%;display:block;width:200%;height:200%;content:" ";background-color:#69f;filter:alpha(opacity=0);opacity:0}@media (min-width:768px){.cropper-point.point-se{width:15px;height:15px}}@media (min-width:992px){.cropper-point.point-se{width:10px;height:10px}}@media (min-width:1200px){.cropper-point.point-se{width:5px;height:5px;filter:alpha(opacity=75);opacity:.75}}.cropper-bg{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-invisible{filter:alpha(opacity=0);opacity:0}.cropper-hide{position:fixed;top:0;left:0;z-index:-1;width:auto!important;min-width:0!important;max-width:none!important;height:auto!important;min-height:0!important;max-height:none!important;filter:alpha(opacity=0);opacity:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-canvas,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}
* Date: 2019-10-04T04:33:44.164Z
*/.cropper-container{direction:ltr;font-size:0;line-height:0;position:relative;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.cropper-container img{display:block;height:100%;image-orientation:0deg;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal,.cropper-wrap-box{bottom:0;left:0;position:absolute;right:0;top:0}.cropper-canvas,.cropper-wrap-box{overflow:hidden}.cropper-drag-box{background-color:#fff;opacity:0}.cropper-modal{background-color:#000;opacity:.5}.cropper-view-box{display:block;height:100%;outline:1px solid #39f;outline-color:rgba(51,153,255,.75);overflow:hidden;width:100%}.cropper-dashed{border:0 dashed #eee;display:block;opacity:.5;position:absolute}.cropper-dashed.dashed-h{border-bottom-width:1px;border-top-width:1px;height:33.33333%;left:0;top:33.33333%;width:100%}.cropper-dashed.dashed-v{border-left-width:1px;border-right-width:1px;height:100%;left:33.33333%;top:0;width:33.33333%}.cropper-center{display:block;height:0;left:50%;opacity:.75;position:absolute;top:50%;width:0}.cropper-center:after,.cropper-center:before{background-color:#eee;content:" ";display:block;position:absolute}.cropper-center:before{height:1px;left:-3px;top:0;width:7px}.cropper-center:after{height:7px;left:0;top:-3px;width:1px}.cropper-face,.cropper-line,.cropper-point{display:block;height:100%;opacity:.1;position:absolute;width:100%}.cropper-face{background-color:#fff;left:0;top:0}.cropper-line{background-color:#39f}.cropper-line.line-e{cursor:ew-resize;right:-3px;top:0;width:5px}.cropper-line.line-n{cursor:ns-resize;height:5px;left:0;top:-3px}.cropper-line.line-w{cursor:ew-resize;left:-3px;top:0;width:5px}.cropper-line.line-s{bottom:-3px;cursor:ns-resize;height:5px;left:0}.cropper-point{background-color:#39f;height:5px;opacity:.75;width:5px}.cropper-point.point-e{cursor:ew-resize;margin-top:-3px;right:-3px;top:50%}.cropper-point.point-n{cursor:ns-resize;left:50%;margin-left:-3px;top:-3px}.cropper-point.point-w{cursor:ew-resize;left:-3px;margin-top:-3px;top:50%}.cropper-point.point-s{bottom:-3px;cursor:s-resize;left:50%;margin-left:-3px}.cropper-point.point-ne{cursor:nesw-resize;right:-3px;top:-3px}.cropper-point.point-nw{cursor:nwse-resize;left:-3px;top:-3px}.cropper-point.point-sw{bottom:-3px;cursor:nesw-resize;left:-3px}.cropper-point.point-se{bottom:-3px;cursor:nwse-resize;height:20px;opacity:1;right:-3px;width:20px}@media (min-width:768px){.cropper-point.point-se{height:15px;width:15px}}@media (min-width:992px){.cropper-point.point-se{height:10px;width:10px}}@media (min-width:1200px){.cropper-point.point-se{height:5px;opacity:.75;width:5px}}.cropper-point.point-se:before{background-color:#39f;bottom:-50%;content:" ";display:block;height:200%;opacity:0;position:absolute;right:-50%;width:200%}.cropper-invisible{opacity:0}.cropper-bg{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC")}.cropper-hide{display:block;height:0;position:absolute;width:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

10
packages/iqcontent/laravel-filemanager/public/js/cropper.min.js vendored Executable file → Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,73 @@
/*!
* jQuery Cropper v1.0.1
* https://fengyuanchen.github.io/jquery-cropper
*
* Copyright 2018-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2019-10-19T08:48:33.062Z
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery'), require('cropperjs')) :
typeof define === 'function' && define.amd ? define(['jquery', 'cropperjs'], factory) :
(global = global || self, factory(global.jQuery, global.Cropper));
}(this, function ($, Cropper) { 'use strict';
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
Cropper = Cropper && Cropper.hasOwnProperty('default') ? Cropper['default'] : Cropper;
if ($ && $.fn && Cropper) {
var AnotherCropper = $.fn.cropper;
var NAMESPACE = 'cropper';
$.fn.cropper = function jQueryCropper(option) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var result;
this.each(function (i, element) {
var $element = $(element);
var isDestroy = option === 'destroy';
var cropper = $element.data(NAMESPACE);
if (!cropper) {
if (isDestroy) {
return;
}
var options = $.extend({}, $element.data(), $.isPlainObject(option) && option);
cropper = new Cropper(element, options);
$element.data(NAMESPACE, cropper);
}
if (typeof option === 'string') {
var fn = cropper[option];
if ($.isFunction(fn)) {
result = fn.apply(cropper, args);
if (result === cropper) {
result = undefined;
}
if (isDestroy) {
$element.removeData(NAMESPACE);
}
}
}
});
return result !== undefined ? result : this;
};
$.fn.cropper.Constructor = Cropper;
$.fn.cropper.setDefaults = Cropper.setDefaults;
$.fn.cropper.noConflict = function noConflict() {
$.fn.cropper = AnotherCropper;
return this;
};
}
}));

View file

@ -0,0 +1,10 @@
/*!
* jQuery Cropper v1.0.1
* https://fengyuanchen.github.io/jquery-cropper
*
* Copyright 2018-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2019-10-19T08:48:33.062Z
*/
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(require("jquery"),require("cropperjs")):"function"==typeof define&&define.amd?define(["jquery","cropperjs"],r):r((e=e||self).jQuery,e.Cropper)}(this,function(c,s){"use strict";if(c=c&&c.hasOwnProperty("default")?c.default:c,s=s&&s.hasOwnProperty("default")?s.default:s,c&&c.fn&&s){var e=c.fn.cropper,d="cropper";c.fn.cropper=function(p){for(var e=arguments.length,a=new Array(1<e?e-1:0),r=1;r<e;r++)a[r-1]=arguments[r];var u;return this.each(function(e,r){var t=c(r),n="destroy"===p,o=t.data(d);if(!o){if(n)return;var f=c.extend({},t.data(),c.isPlainObject(p)&&p);o=new s(r,f),t.data(d,o)}if("string"==typeof p){var i=o[p];c.isFunction(i)&&((u=i.apply(o,a))===o&&(u=void 0),n&&t.removeData(d))}}),void 0!==u?u:this},c.fn.cropper.Constructor=s,c.fn.cropper.setDefaults=s.setDefaults,c.fn.cropper.noConflict=function(){return c.fn.cropper=e,this}}});

View file

@ -10,6 +10,15 @@ use IqContent\LaravelFilemanager\Events\FolderWasRenamed;
class ColorController extends LfmController
{
public function getColor()
{
return view('laravel-filemanager::colors')
->with([
'working_dir' => request('working_dir'),
'color' => request('color')
]);
}
public function performColor()
{
$file_name = $this->helper->input('file');
$new_color = $this->helper->input('new_color');

View file

@ -5,6 +5,7 @@ namespace IqContent\LaravelFilemanager\Controllers;
use Intervention\Image\Facades\Image;
use IqContent\LaravelFilemanager\Events\ImageIsCropping;
use IqContent\LaravelFilemanager\Events\ImageWasCropped;
use IqContent\LaravelFilemanager\Models\IQContentFile;
class CropController extends LfmController
{
@ -34,21 +35,42 @@ class CropController extends LfmController
if (! $overWrite) {
$fileParts = explode('.', $image_name);
$fileParts[count($fileParts) - 2] = $fileParts[count($fileParts) - 2] . '_cropped_' . time();
$crop_path = $this->lfm->setName(implode('.', $fileParts))->path('absolute');
$image_name = implode('.', $fileParts);
$crop_path = $this->lfm->setName($image_name)->path('absolute');
}
event(new ImageIsCropping($image_path));
$crop_info = request()->only('dataWidth', 'dataHeight', 'dataX', 'dataY');
// crop image
Image::make($image_path)
$image = Image::make($image_path)
->crop(...array_values($crop_info))
->save($crop_path);
// make new thumbnail
$this->lfm->makeThumbnail($image_name);
$new_file = $this->lfm->pretty($image_name);
$working_folder_id = $new_file->getModelParentFolderId();
$mimeType = $new_file->mimeType();
$extension = $new_file->extension();
$size = \File::size($crop_path);
IQContentFile::create([
'folder_id' => $working_folder_id,
'name' => $image_name,
'identifier' => $image_name,
'ext' => $extension,
'mine' => $mimeType,
'size' => $size / 1000,
'dimensions' => $image->width()."x".$image->height(),
'content' => '',
]);
event(new ImageWasCropped($image_path));
}

View file

@ -0,0 +1,253 @@
<?php
namespace IqContent\LaravelFilemanager\Controllers;
use Intervention\Image\Facades\Image;
use IqContent\LaravelFilemanager\Events\ImageIsCropping;
use IqContent\LaravelFilemanager\Events\ImageWasCropped;
use IqContent\LaravelFilemanager\Models\IQContentFile;
class FileController extends LfmController
{
private $apikey = 'AIzaSyC31Tf0rZVYqRRcUNk4XXPtV5yzKDzkb1E';
/**
* Show crop page.
*
* @return mixed
*/
public function getFile()
{
return view('laravel-filemanager::file')
->with([
'working_dir' => request('working_dir'),
]);
}
/**
* Crop the image (called via ajax).
*/
public function performFile($overWrite = true)
{
//$working_dir = request('working_dir');
$file_type = request('file_type');
if($file_type === 'youtube'){
return $this->createYoutubeFile($file_type);
}
/* if(!$file_name || $file_name == ""){
$file_name = "newEmptyFile.".$file_type;
}else{
$file_name = $file_name.".".$file_type;
}
$file_name = request('file_name');
$file_content = request('file_content');*/
return $this->response('error', "unbekannter File Typ");
}
private function createYoutubeFile($file_type){
$youtube_video_id = request('file_content');
$value = $this->readGoogleApi($youtube_video_id);
if(!$value || !isset($value['items'][0]['snippet']['title'])){
return $this->response('error', "youtube ID nicht gefunden: ".$youtube_video_id);
}
$file_title = $value['items'][0]['snippet']['title'];
if (config('lfm.alphanumeric_filename')) {
$file_title = $this->helper->sanitize($file_title);
}
$file_name = $file_title.".".$file_type;
if ($this->lfm->setName($file_name)->exists()) {
return $this->response('error', parent::getError('move-exist'));
}
$new_file = $this->lfm->pretty($file_name);
$working_folder_id = $new_file->getModelParentFolderId();
$file_path = $new_file->path();
//Storage::disk('local')->put('file.txt', 'Contents');
$new_file->put($youtube_video_id);
$mimeType = $file_type;
$extension = $file_type;
$size = \File::size($file_path);
//thumbnails
if(isset($value['items'][0]['snippet']['thumbnails']['standard']['url'])) {
// create folder for thumbnails
$this->lfm->makeThumbnailURL($file_title.".jpg", $value['items'][0]['snippet']['thumbnails']['standard']['url']);
//image from url
// $image = Image::make($value['items'][0]['snippet']['thumbnails']['standard']['url']);
// $image->fit(config('lfm.thumb_img_width', 200), config('lfm.thumb_img_height', 200));
// $this->lfm->storage->put($image->stream()->detach());
}
IQContentFile::create([
'folder_id' => $working_folder_id,
'name' => $new_file->name(),
'identifier' => $new_file->name(),
'ext' => $extension,
'mine' => $mimeType,
'size' => $size / 1000,
'dimensions' => '',
'content' => $youtube_video_id,
]);
return parent::$success_response;
}
private function readGoogleApi($videoId){
$googleApiUrl = 'https://www.googleapis.com/youtube/v3/videos?id=' . $videoId . '&key=' . $this->apikey . '&part=snippet';
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $googleApiUrl);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response);
$value = json_decode(json_encode($data), true);
return $value;
}
}
// $title = $value['items'][0]['snippet']['title'];
// $description = $value['items'][0]['snippet']['description'];
/*
*
*
array(4) {
["kind"]=>
string(25) "youtube#videoListResponse"
["etag"]=>
string(57) ""j6xRRd8dTPVVptg711_CSPADRfg/TOFYJKnMf1x6cO7CgAzk3K2BaRw""
["pageInfo"]=>
array(2) {
["totalResults"]=>
int(1)
["resultsPerPage"]=>
int(1)
}
["items"]=>
array(1) {
[0]=>
array(4) {
["kind"]=>
string(13) "youtube#video"
["etag"]=>
string(57) ""j6xRRd8dTPVVptg711_CSPADRfg/pVQe28OgNai40jPirl_G00FJDw8""
["id"]=>
string(11) "Rpo5py2fjrg"
["snippet"]=>
array(10) {
["publishedAt"]=>
string(24) "2018-12-23T22:42:41.000Z"
["channelId"]=>
string(24) "UCZZ5ZL0Wiv90RF2KDuR_mFA"
["title"]=>
string(16) "Wir: STERN TOURS"
["description"]=>
string(55) "Reiseveranstalter und Kulturreise-Spezialist aus Berlin"
["thumbnails"]=>
array(5) {
["default"]=>
array(3) {
["url"]=>
string(46) "https://i.ytimg.com/vi/Rpo5py2fjrg/default.jpg"
["width"]=>
int(120)
["height"]=>
int(90)
}
["medium"]=>
array(3) {
["url"]=>
string(48) "https://i.ytimg.com/vi/Rpo5py2fjrg/mqdefault.jpg"
["width"]=>
int(320)
["height"]=>
int(180)
}
["high"]=>
array(3) {
["url"]=>
string(48) "https://i.ytimg.com/vi/Rpo5py2fjrg/hqdefault.jpg"
["width"]=>
int(480)
["height"]=>
int(360)
}
["standard"]=>
array(3) {
["url"]=>
string(48) "https://i.ytimg.com/vi/Rpo5py2fjrg/sddefault.jpg"
["width"]=>
int(640)
["height"]=>
int(480)
}
["maxres"]=>
array(3) {
["url"]=>
string(52) "https://i.ytimg.com/vi/Rpo5py2fjrg/maxresdefault.jpg"
["width"]=>
int(1280)
["height"]=>
int(720)
}
}
["channelTitle"]=>
string(10) "SternTours"
["tags"]=>
array(1) {
[0]=>
string(11) "STERN TOURS"
}
["categoryId"]=>
string(2) "19"
["liveBroadcastContent"]=>
string(4) "none"
["localized"]=>
array(2) {
["title"]=>
string(16) "Wir: STERN TOURS"
["description"]=>
string(55) "Reiseveranstalter und Kulturreise-Spezialist aus Berlin"
}
}
}
}
}
*/
//Preview image
//https://img.youtube.com/vi/Rpo5py2fjrg/hqdefault.jpg
//https://www.googleapis.com/youtube/v3/videos
//https://www.googleapis.com/youtube/v3/videos?part=snippet&id={YOUTUBE_VIDEO_ID}&fields=items(id%2Csnippet)&key={YOUR_API_KEY}
//http://gdata.youtube.com/feeds/api/videos/Rpo5py2fjrg

View file

@ -69,7 +69,11 @@ class ItemsController extends LfmController
foreach ($lfm->folders() as $folder){
if($folder->name() == $old_file->name()){
return $this->response('error', parent::getError('move-exist'));
}
}
foreach ($lfm->files() as $files){
if($files->name() == $old_file->name()){
return $this->response('error', parent::getError('move-exist'));
}
}

View file

@ -346,18 +346,36 @@ class Lfm
'as' => 'getCropimage',
]);
// add-file
Route::get('/add-file', [
'uses' => 'FileController@getFile',
'as' => 'getFile',
]);
// add-file
Route::get('/add-dofile', [
'uses' => 'FileController@performFile',
'as' => 'performFile',
]);
// rename
Route::get('/rename', [
'uses' => 'RenameController@getRename',
'as' => 'getRename',
'as' => 'getFile',
]);
// colorshue
Route::get('/colorshue', [
Route::get('/colorhue', [
'uses' => 'ColorController@getColor',
'as' => 'getColor',
]);
// colorshue
Route::get('/docolorhue', [
'uses' => 'ColorController@performColor',
'as' => 'performColor',
]);
// scale/resize
Route::get('/resize', [
'uses' => 'ResizeController@getResize',

View file

@ -9,7 +9,7 @@ class LfmItem
private $lfm;
private $helper;
private $columns = ['name', 'url', 'time', 'icon', 'color', 'is_file', 'is_image', 'thumb_url'];
private $columns = ['name', 'url', 'time', 'icon', 'color', 'is_file', 'is_image', 'thumb_url', 'size', 'dimension', 'content'];
public $attributes = [];
public function __construct(LfmPath $lfm, Lfm $helper)
@ -70,7 +70,7 @@ class LfmItem
*/
public function isImage()
{
return starts_with($this->mimeType(), 'image');
return (strpos($this->mimeType(), 'image') !== false);
}
/**
@ -94,6 +94,11 @@ class LfmItem
return $this->lfm->extension();
}
public function put($content)
{
return $this->lfm->put($content);
}
public function url()
{
if ($this->isDirectory()) {
@ -105,7 +110,23 @@ class LfmItem
public function size()
{
return $this->isFile() ? $this->humanFilesize($this->lfm->size()) : '';
if($this->model()){
return $this->isFile() ? $this->humanFilesize($this->model()->size) : '';
}
}
public function content()
{
if($this->model()){
return $this->model()->content;
}
}
public function sizeRow()
{
return $this->isFile() ? $this->lfm->size() : '';
}
public function time()
@ -113,6 +134,17 @@ class LfmItem
return $this->lfm->lastModified();
}
public function dimension()
{
if ($this->isImage()) {
if($this->model()) {
return $this->model()->dimensions;
}
}
return "";
}
public function dimensions()
{
@ -123,15 +155,26 @@ class LfmItem
return null;
}
public function getModelParentFolderId(){
return $this->lfm->getModelParentFolderId();
}
public function thumbUrl()
{
//edit
if ($this->isDirectory()) {
return null;
}
if ($this->isImage()) {
return $this->lfm->thumb($this->hasThumb())->url(true);
return $this->lfm->thumb($this->hasThumb())->url();
}
if ($this->extension() === "youtube") {
$name = str_replace(".youtube", ".jpg", $this->name());
return $this->lfm->setName($name)->thumb(true)->url();
}
return null;
@ -223,9 +266,12 @@ class LfmItem
* @param int $decimals Decimals.
* @return string
*/
public function humanFilesize($bytes, $decimals = 2)
public function humanFilesize($bytes = 0, $decimals = 2)
{
$size = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
if($bytes == 0){
return "";
}
$size = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
$factor = floor((strlen($bytes) - 1) / 3);
return sprintf("%.{$decimals}f %s", $bytes / pow(1024, $factor), @$size[$factor]);

View file

@ -229,11 +229,14 @@ class LfmPath
$parent_folder_id = $this->getModelParentFolderId();
$this->storage->makeDirectory(0777, true, true);
IQContentFolder::create([
'folder_id' => $parent_folder_id,
'name' => $this->item_name,
'identifier' => $this->item_name,
]);
if(!$this->is_thumb){
IQContentFolder::create([
'folder_id' => $parent_folder_id,
'name' => $this->item_name,
'identifier' => $this->item_name,
]);
}
}
public function isDirectory()
@ -425,4 +428,16 @@ class LfmPath
$this->storage->put($image->stream()->detach());
}
public function makeThumbnailURL($file_name, $url)
{
// create folder for thumbnails
$this->setName(null)->thumb(true)->createFolder();
// generate cropped image content
$this->setName($file_name)->thumb(true);
$image = Image::make($url);
// $this->image_dimensions = $image->width()."x".$image->height();
$image->fit(config('lfm.thumb_img_width', 200), config('lfm.thumb_img_height', 200));
$this->storage->put($image->stream()->detach());
}
}

View file

@ -43,6 +43,8 @@ return [
'message-extension_not_found' => 'Installieren Sie gd oder imagick Erweiterung um Bilder zuzuschneiden, Größe ändern und Thumbnails zu erstellen.',
'message-drop' => 'Or drop files here to upload',
'file-name' => 'Neue Datei:',
'error-rename' => 'Dateiname wird bereits verwendet!',
'error-file-name' => 'File name cannot be empty!',
'error-file-empty' => 'Sie müssen eine Datei auswählen!',
@ -74,9 +76,9 @@ return [
'btn-uploading' => 'Hochladen...',
'btn-close' => 'Schließen',
'btn-crop' => 'Zuschneiden',
'btn-cancel' => 'Stornieren',
'btn-cancel' => 'schließen',
'btn-resize' => 'Größe ändern',
'btn-copy-crop' => 'Copy & Crop',
'btn-copy-crop' => 'kopieren & zuschneiden',
'btn-crop-free' => 'Free',
'btn-confirm' => 'Okay',
'btn-open' => 'Ordner öffnen Folder',

View file

@ -0,0 +1,104 @@
<div class="row no-gutters">
<div class="col-xl-8">
<div class="crop-container">
<img src="{{ $img->url . '?timestamp=' . $img->time }}" class="img img-responsive">
</div>
</div>
<div class="col-xl-4">
<div class="text-center">
<div class="img-preview center-block"></div>
<br>
<div class="btn-group clearfix">
<label class="btn btn-info btn-aspectRatio active" onclick="changeAspectRatio(this, 16 / 9)">
16:9
</label>
<label class="btn btn-info btn-aspectRatio" onclick="changeAspectRatio(this, 4 / 3)">
4:3
</label>
<label class="btn btn-info btn-aspectRatio" onclick="changeAspectRatio(this, 1)">
1:1
</label>
<label class="btn btn-info btn-aspectRatio" onclick="changeAspectRatio(this, 2 / 3)">
2:3
</label>
<label class="btn btn-info btn-aspectRatio" onclick="changeAspectRatio(this, null)">
{{ trans('laravel-filemanager::lfm.btn-crop-free') }}
</label>
</div>
<br>
<br>
<div class="btn-group clearfix">
<button class="btn btn-secondary" onclick="loadItems()">{{ trans('laravel-filemanager::lfm.btn-cancel') }}</button>
<button class="btn btn-warning" onclick="performCropNew()">{{ trans('laravel-filemanager::lfm.btn-copy-crop') }}</button>
<button class="btn btn-primary" onclick="performCrop()">{{ trans('laravel-filemanager::lfm.btn-crop') }}</button>
</div>
<form id='cropForm'>
<input type="hidden" id="img" name="img" value="{{ $img->name }}">
<input type="hidden" id="working_dir" name="working_dir" value="{{ $working_dir }}">
<input type="hidden" id="dataX" name="dataX">
<input type="hidden" id="dataY" name="dataY">
<input type="hidden" id="dataWidth" name="dataWidth">
<input type="hidden" id="dataHeight" name="dataHeight">
<input type='hidden' name='_token' value='{{csrf_token()}}'>
</form>
</div>
</div>
</div>
<script>
var $image = null,
options = {};
$(document).ready(function () {
var $dataX = $('#dataX'),
$dataY = $('#dataY'),
$dataHeight = $('#dataHeight'),
$dataWidth = $('#dataWidth');
$image = $('.crop-container > img');
options = {
aspectRatio: 16 / 9,
preview: ".img-preview",
strict: false,
crop: function (data) {
// Output the result data for cropping image.
$dataX.val(Math.round(data.x));
$dataY.val(Math.round(data.y));
$dataHeight.val(Math.round(data.height));
$dataWidth.val(Math.round(data.width));
}
};
$image.cropper(options);
});
function changeAspectRatio(_this, aspectRatio) {
options.aspectRatio = aspectRatio;
$('.btn-aspectRatio.active').removeClass('active');
$(_this).addClass('active');
$('.img-preview').removeAttr('style');
$image.cropper('destroy').cropper(options);
return false;
}
function performCrop() {
performLfmRequest('cropimage', {
img: $("#img").val(),
working_dir: $("#working_dir").val(),
dataX: $("#dataX").val(),
dataY: $("#dataY").val(),
dataHeight: $("#dataHeight").val(),
dataWidth: $("#dataWidth").val(),
type: $('#type').val()
}).done(loadItems);
}
function performCropNew() {
performLfmRequest('cropnewimage', {
img: $("#img").val(),
working_dir: $("#working_dir").val(),
dataX: $("#dataX").val(),
dataY: $("#dataY").val(),
dataHeight: $("#dataHeight").val(),
dataWidth: $("#dataWidth").val(),
type: $('#type').val()
}).done(loadItems);
}
</script>

View file

@ -0,0 +1,34 @@
<input type="text" name="color" id="minicolors-hue" class="form-control" value="{{$color}}">
<script>
$(document).ready(function () {
$("#notify").on("shown.bs.modal", function() {
});
});
function colorshue(title, color, callback) {
$('#notify').find('input').unbind('keypress.key13').bind('keypress.key13', function (e) {
if (e.which === 13) {
$('#notify').find('.btn-primary').click();
}
});
// $('#colorhue').modal('show').find('.modal-title').text(title);
}
$('#minicolors-hue').minicolors({
control: 'hue',
position: 'bottom ' + 'left',
});
</script>

View file

@ -1,10 +1,15 @@
<style>
img {
max-width: 100%;
}
</style>
<div class="row no-gutters">
<div class="col-xl-8">
<div class="col-12">
<div class="crop-container">
<img src="{{ $img->url . '?timestamp=' . $img->time }}" class="img img-responsive">
</div>
</div>
<div class="col-xl-4">
<div class="col-12">
<div class="text-center">
<div class="img-preview center-block"></div>
<br>
@ -28,9 +33,8 @@
<br>
<br>
<div class="btn-group clearfix">
<button class="btn btn-secondary" onclick="loadItems()">{{ trans('laravel-filemanager::lfm.btn-cancel') }}</button>
<button class="btn btn-warning" onclick="performCropNew()">{{ trans('laravel-filemanager::lfm.btn-copy-crop') }}</button>
<button class="btn btn-primary" onclick="performCrop()">{{ trans('laravel-filemanager::lfm.btn-crop') }}</button>
<button class="btn btn-primary" onclick="performCropNew()">{{ trans('laravel-filemanager::lfm.btn-copy-crop') }}</button>
<!-- <button class="btn btn-primary" onclick="performCrop()">{{ trans('laravel-filemanager::lfm.btn-crop') }}</button> -->
</div>
<form id='cropForm'>
<input type="hidden" id="img" name="img" value="{{ $img->name }}">
@ -50,26 +54,39 @@
options = {};
$(document).ready(function () {
$("#notify").on("shown.bs.modal", function() {
var $dataX = $('#dataX'),
$dataY = $('#dataY'),
$dataHeight = $('#dataHeight'),
$dataWidth = $('#dataWidth');
$dataY = $('#dataY'),
$dataHeight = $('#dataHeight'),
$dataWidth = $('#dataWidth');
$image = $('.crop-container > img');
options = {
aspectRatio: 16 / 9,
preview: ".img-preview",
strict: false,
crop: function (data) {
// Output the result data for cropping image.
$dataX.val(Math.round(data.x));
$dataY.val(Math.round(data.y));
$dataHeight.val(Math.round(data.height));
$dataWidth.val(Math.round(data.width));
}
aspectRatio: 16 / 9,
preview: ".img-preview",
strict: false,
crop: function (data) {
console.log(data);
// Output the result data for cropping image.
$dataX.val(Math.round(data.x));
$dataY.val(Math.round(data.y));
$dataHeight.val(Math.round(data.height));
$dataWidth.val(Math.round(data.width));
}
};
$image.cropper(options);
});
});
function closeAndLoadItems() {
$image = $('.crop-container > img');
$image.cropper('destroy');
$('#notify').modal('hide').find('.modal-body').html("");
loadItems();
}
function changeAspectRatio(_this, aspectRatio) {
options.aspectRatio = aspectRatio;
$('.btn-aspectRatio.active').removeClass('active');
@ -87,7 +104,7 @@
dataHeight: $("#dataHeight").val(),
dataWidth: $("#dataWidth").val(),
type: $('#type').val()
}).done(loadItems);
}).done(closeAndLoadItems);
}
function performCropNew() {
@ -99,6 +116,6 @@
dataHeight: $("#dataHeight").val(),
dataWidth: $("#dataWidth").val(),
type: $('#type').val()
}).done(loadItems);
}).done(closeAndLoadItems);
}
</script>

View file

@ -0,0 +1,25 @@
<form id='fileForm'>
<div class="form-group">
<label class="form-label" for="file_type">Typ*</label>
<select class="custom-select" data-style="btn-default" name="from_file_type" id="from_file_type">
<option value="youtube">Youtube</option>
<!--<option value="txt">Text</option> -->
</select>
</div>
<div class="form-group">
<label class="form-label" for="file_type">Youtube Video ID*</label>
<input type="text" class="form-control" name="form_file_content" id="form_file_content" placeholder="Nur die ID des Video angeben" required>
</div>
<input type="hidden" id="working_dir" name="working_dir" value="{{ $working_dir }}">
<input type='hidden' name='_token' value='{{csrf_token()}}'>
</form>
<script>
</script>