Media youtube, title description, CMS Info Content / Header Frontend
This commit is contained in:
parent
c9f3d85d4e
commit
7294ccc1d0
49 changed files with 1283 additions and 148 deletions
|
|
@ -23,7 +23,7 @@ class DeleteController extends LfmController
|
|||
$file_path = $file_to_delete->path();
|
||||
|
||||
|
||||
event(new ImageIsDeleting($file_path));
|
||||
//event(new ImageIsDeleting($file_path));
|
||||
|
||||
if (is_null($name_to_delete)) {
|
||||
return $this->response('error', parent::getError('folder-name'));
|
||||
|
|
@ -39,9 +39,13 @@ class DeleteController extends LfmController
|
|||
return $this->response('error', parent::getError('delete-folder'));
|
||||
}
|
||||
} else {
|
||||
if ($file_to_delete->isImage()) {
|
||||
if ($file_to_delete->hasThumb()) {
|
||||
$this->lfm->setName($name_to_delete)->thumb()->delete();
|
||||
}
|
||||
if ($file_to_delete->hasThumbEX()) {
|
||||
$thumb_to_delete = str_replace('.youtube', '.jpg', $name_to_delete);
|
||||
$this->lfm->setName($thumb_to_delete)->thumb()->delete();
|
||||
}
|
||||
}
|
||||
$model = $file_to_delete->model();
|
||||
if($model && $model->id){
|
||||
|
|
@ -50,7 +54,7 @@ class DeleteController extends LfmController
|
|||
|
||||
$this->lfm->setName($name_to_delete)->delete();
|
||||
|
||||
event(new ImageWasDeleted($file_path));
|
||||
//event(new ImageWasDeleted($file_path));
|
||||
}
|
||||
|
||||
if (count($errors) > 0) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class FileController extends LfmController
|
|||
'working_dir' => request('working_dir'),
|
||||
]);
|
||||
}
|
||||
|
||||
//Rpo5py2fjrg
|
||||
/**
|
||||
* Crop the image (called via ajax).
|
||||
*/
|
||||
|
|
@ -49,6 +49,35 @@ class FileController extends LfmController
|
|||
|
||||
}
|
||||
|
||||
public function fileContent(){
|
||||
|
||||
$file_name = $this->helper->input('file');
|
||||
$content_id = $this->helper->input('content_id');
|
||||
$content_title = $this->helper->input('content_title');
|
||||
$content_description = $this->helper->input('content_description');
|
||||
|
||||
$file = $this->lfm->pretty($file_name);
|
||||
|
||||
|
||||
$content = [
|
||||
'id' => $content_id,
|
||||
'title' => $content_title,
|
||||
'description' => $content_description,
|
||||
];
|
||||
|
||||
if($content_id && $content_id != ""){
|
||||
$file->put(json_encode($content));
|
||||
}
|
||||
|
||||
$model = $file->model();
|
||||
if($model && $model->id){
|
||||
$model->content = $content;
|
||||
$model->save();
|
||||
}
|
||||
return parent::$success_response;
|
||||
|
||||
}
|
||||
|
||||
private function createYoutubeFile($file_type){
|
||||
|
||||
$youtube_video_id = request('file_content');
|
||||
|
|
@ -58,9 +87,12 @@ class FileController extends LfmController
|
|||
return $this->response('error', "youtube ID nicht gefunden: ".$youtube_video_id);
|
||||
}
|
||||
|
||||
$file_title = $value['items'][0]['snippet']['title'];
|
||||
$file_title_row = isset($value['items'][0]['snippet']['title']) ? $value['items'][0]['snippet']['title'] : "";
|
||||
$file_description = isset($value['items'][0]['snippet']['description']) ? $value['items'][0]['snippet']['description'] : "";
|
||||
if (config('lfm.alphanumeric_filename')) {
|
||||
$file_title = $this->helper->sanitize($file_title);
|
||||
$file_title = $this->helper->sanitize($file_title_row);
|
||||
}else{
|
||||
$file_title = $file_title_row;
|
||||
}
|
||||
$file_name = $file_title.".".$file_type;
|
||||
|
||||
|
|
@ -71,8 +103,16 @@ class FileController extends LfmController
|
|||
$new_file = $this->lfm->pretty($file_name);
|
||||
$working_folder_id = $new_file->getModelParentFolderId();
|
||||
$file_path = $new_file->path();
|
||||
|
||||
$content = [
|
||||
'id' => $youtube_video_id,
|
||||
'title' => $file_title_row,
|
||||
'description' => $file_description,
|
||||
];
|
||||
|
||||
|
||||
//Storage::disk('local')->put('file.txt', 'Contents');
|
||||
$new_file->put($youtube_video_id);
|
||||
$new_file->put(json_encode($content));
|
||||
|
||||
$mimeType = $file_type;
|
||||
$extension = $file_type;
|
||||
|
|
@ -88,16 +128,15 @@ class FileController extends LfmController
|
|||
// $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(),
|
||||
'identifier' => $youtube_video_id,
|
||||
'ext' => $extension,
|
||||
'mine' => $mimeType,
|
||||
'size' => $size / 1000,
|
||||
'dimensions' => '',
|
||||
'content' => $youtube_video_id,
|
||||
'content' => $content,
|
||||
]);
|
||||
|
||||
return parent::$success_response;
|
||||
|
|
|
|||
|
|
@ -85,13 +85,19 @@ class ItemsController extends LfmController
|
|||
|
||||
|
||||
if ($old_file->hasThumb()) {
|
||||
$new_file_thmub = $this->lfm->setName($item)->thumb()->dir($target);
|
||||
$new_file_thumb = $this->lfm->setName($item)->thumb()->dir($target);
|
||||
/* if ($is_directory) {
|
||||
event(new FolderIsMoving($old_file->path(), $new_file_thmub->path()));
|
||||
} else {
|
||||
event(new FileIsMoving($old_file->path(), $new_file_thmub->path()));
|
||||
}*/
|
||||
$this->lfm->setName($item)->thumb()->move($new_file_thmub);
|
||||
$this->lfm->setName($item)->thumb()->move($new_file_thumb);
|
||||
}
|
||||
|
||||
if ($old_file->hasThumbEX()) {
|
||||
$thumb_item = str_replace('.youtube', '.jpg', $item);
|
||||
$new_file_thumb = $this->lfm->setName($thumb_item)->thumb()->dir($target);
|
||||
$this->lfm->setName($thumb_item)->thumb()->move($new_file_thumb);
|
||||
}
|
||||
|
||||
$new_file = $this->lfm->setName($item)->dir($target);
|
||||
|
|
|
|||
|
|
@ -67,6 +67,13 @@ class RenameController extends LfmController
|
|||
->move($this->lfm->setName($new_name)->thumb());
|
||||
}
|
||||
|
||||
if ($old_file->hasThumbEX()) {
|
||||
$thumb_old_name = str_replace('.youtube', '.jpg', $old_name);
|
||||
$thumb_new_name = str_replace('.youtube', '.jpg', $new_name);
|
||||
$this->lfm->setName($thumb_old_name)->thumb()
|
||||
->move($this->lfm->setName($thumb_new_name)->thumb());
|
||||
}
|
||||
|
||||
$this->lfm->setName($old_name)
|
||||
->move($this->lfm->setName($new_name));
|
||||
|
||||
|
|
|
|||
|
|
@ -352,12 +352,18 @@ class Lfm
|
|||
'as' => 'getFile',
|
||||
]);
|
||||
|
||||
// add-file
|
||||
// add-file-perform
|
||||
Route::get('/add-dofile', [
|
||||
'uses' => 'FileController@performFile',
|
||||
'as' => 'performFile',
|
||||
]);
|
||||
|
||||
// file-content
|
||||
Route::get('/file-content', [
|
||||
'uses' => 'FileController@fileContent',
|
||||
'as' => 'getFile',
|
||||
]);
|
||||
|
||||
// rename
|
||||
Route::get('/rename', [
|
||||
'uses' => 'RenameController@getRename',
|
||||
|
|
|
|||
|
|
@ -173,8 +173,12 @@ class LfmItem
|
|||
}
|
||||
|
||||
if ($this->extension() === "youtube") {
|
||||
$name = str_replace(".youtube", ".jpg", $this->name());
|
||||
return $this->lfm->setName($name)->thumb(true)->url();
|
||||
$thumb_name = "thumbs/".str_replace(".youtube", ".jpg", $this->name());
|
||||
return str_replace($this->name(), $thumb_name, $this->lfm->thumb($this->hasThumb())->url());
|
||||
/*if(!empty($this->lfm->setName($name)->thumb(true)->url())){
|
||||
return null;
|
||||
|
||||
}*/
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -202,7 +206,7 @@ class LfmItem
|
|||
if($model && $model->color){
|
||||
return $this->model()->color;
|
||||
}
|
||||
return '#';
|
||||
return '#f2bf24';
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -219,6 +223,15 @@ class LfmItem
|
|||
return $this->helper->getFileType($this->extension());
|
||||
}
|
||||
|
||||
public function hasThumbEx()
|
||||
{
|
||||
if($this->extension() === "youtube"){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public function hasThumb()
|
||||
{
|
||||
if (!$this->isImage()) {
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ class LfmPath
|
|||
|
||||
public function url()
|
||||
{
|
||||
return $this->storage->url($this->path('url'));
|
||||
return $this->storage->url($this->path('url'));
|
||||
}
|
||||
|
||||
public function folders()
|
||||
|
|
@ -430,11 +430,13 @@ class LfmPath
|
|||
|
||||
public function makeThumbnailURL($file_name, $url)
|
||||
{
|
||||
ini_set("allow_url_fopen", 1);
|
||||
// create folder for thumbnails
|
||||
$this->setName(null)->thumb(true)->createFolder();
|
||||
// generate cropped image content
|
||||
$this->setName($file_name)->thumb(true);
|
||||
$image = Image::make($url);
|
||||
|
||||
$image = Image::make(file_get_contents($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());
|
||||
|
|
|
|||
|
|
@ -61,6 +61,10 @@ class IQContentFile extends Model
|
|||
'folder_id', 'name', 'identifier', 'ext', 'mine', 'size', 'dimensions', 'content', 'color', 'pos', 'active'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'content' => 'array',
|
||||
];
|
||||
|
||||
public function folder() {
|
||||
return $this->belongsTo('IqContent\LaravelFilemanager\Models\IQContentFolder', 'folder_id');
|
||||
}
|
||||
|
|
|
|||
2
packages/iqcontent/laravel-filemanager/src/robots.txt
Normal file
2
packages/iqcontent/laravel-filemanager/src/robots.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
User-agent: *
|
||||
Disallow:
|
||||
Loading…
Add table
Add a link
Reference in a new issue