Passolution, Mails, Tickets,
This commit is contained in:
parent
0857a34766
commit
f79806ffe8
46 changed files with 556 additions and 831 deletions
|
|
@ -29,9 +29,20 @@ class CropController extends LfmController
|
|||
public function getCropimage($overWrite = true)
|
||||
{
|
||||
$image_name = request('img');
|
||||
|
||||
$old_file = $this->lfm->pretty($image_name);
|
||||
$model = $old_file->model();
|
||||
$content = false;
|
||||
if($model && $model->id){
|
||||
$content = $model->content;
|
||||
}
|
||||
|
||||
|
||||
$image_path = $this->lfm->setName($image_name)->path('absolute');
|
||||
$crop_path = $image_path;
|
||||
|
||||
|
||||
|
||||
if (! $overWrite) {
|
||||
$fileParts = explode('.', $image_name);
|
||||
$fileParts[count($fileParts) - 2] = $fileParts[count($fileParts) - 2] . '_cropped_' . time();
|
||||
|
|
@ -68,7 +79,7 @@ class CropController extends LfmController
|
|||
'mine' => $mimeType,
|
||||
'size' => $size / 1000,
|
||||
'dimensions' => $image->width()."x".$image->height(),
|
||||
'content' => '',
|
||||
'content' => $content ? $content : '',
|
||||
]);
|
||||
|
||||
event(new ImageWasCropped($image_path));
|
||||
|
|
|
|||
|
|
@ -64,22 +64,36 @@ class FileController extends LfmController
|
|||
$content_description = $this->helper->input('content_description');
|
||||
$content_author = $this->helper->input('content_author');
|
||||
|
||||
|
||||
$file = $this->lfm->pretty($file_name);
|
||||
$model = $file->model();
|
||||
|
||||
if($model && $model->id){
|
||||
|
||||
$content = [
|
||||
'id' => $content_id,
|
||||
'title' => $content_title,
|
||||
'description' => $content_description,
|
||||
'author' => $content_author,
|
||||
];
|
||||
//before save - merge with other
|
||||
$content = $model->content;
|
||||
if(!is_array($content)){
|
||||
$content = [];
|
||||
}
|
||||
$content['id'] = $content_id;
|
||||
$content['title'] = $content_title;
|
||||
$content['description'] = $content_description;
|
||||
if($content_author){
|
||||
$content['author'] = $content_author;
|
||||
}
|
||||
}else{
|
||||
$content = [
|
||||
'id' => $content_id,
|
||||
'title' => $content_title,
|
||||
'description' => $content_description,
|
||||
'author' => $content_author,
|
||||
];
|
||||
}
|
||||
|
||||
if($content_id && $content_id != ""){
|
||||
$file->put(json_encode($content));
|
||||
}
|
||||
|
||||
$model = $file->model();
|
||||
|
||||
if($model && $model->id){
|
||||
$model->content = $content;
|
||||
$model->save();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue