Travel Guide Frontend Backend
This commit is contained in:
parent
e6cc042aee
commit
0857a34766
681 changed files with 6680 additions and 1689 deletions
|
|
@ -33,7 +33,9 @@ class FileController extends LfmController
|
|||
//$working_dir = request('working_dir');
|
||||
$file_type = request('file_type');
|
||||
if($file_type === 'youtube'){
|
||||
return $this->createYoutubeFile($file_type);
|
||||
$youtube_video_id = request('file_content');
|
||||
|
||||
return $this->createYoutubeFile($youtube_video_id, $file_type);
|
||||
|
||||
}
|
||||
/* if(!$file_name || $file_name == ""){
|
||||
|
|
@ -49,6 +51,11 @@ class FileController extends LfmController
|
|||
|
||||
}
|
||||
|
||||
public function makeYoutube($working_dir, $youtube_video_id)
|
||||
{
|
||||
return $this->createYoutubeFile($youtube_video_id, 'youtube', $working_dir);
|
||||
}
|
||||
|
||||
public function fileContent(){
|
||||
|
||||
$file_name = $this->helper->input('file');
|
||||
|
|
@ -81,13 +88,17 @@ class FileController extends LfmController
|
|||
|
||||
}
|
||||
|
||||
private function createYoutubeFile($file_type){
|
||||
private function createYoutubeFile($youtube_video_id, $file_type, $working_dir = false){
|
||||
|
||||
$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);
|
||||
if($working_dir){
|
||||
return "youtube ID nicht gefunden: ".$youtube_video_id;
|
||||
}
|
||||
return $this->response('error', "youtube ID nicht gefunden: ".$youtube_video_id);
|
||||
|
||||
|
||||
}
|
||||
|
||||
$file_title_row = isset($value['items'][0]['snippet']['title']) ? $value['items'][0]['snippet']['title'] : "";
|
||||
|
|
@ -99,18 +110,39 @@ class FileController extends LfmController
|
|||
}
|
||||
$file_name = $file_title.".".$file_type;
|
||||
|
||||
if ($this->lfm->setName($file_name)->exists()) {
|
||||
return $this->response('error', parent::getError('move-exist'));
|
||||
if($working_dir){
|
||||
if($this->lfm->setName($file_name)->dir($working_dir)->exists()){
|
||||
return "youtube vorhanden: ".$youtube_video_id;
|
||||
}
|
||||
}else{
|
||||
if ($this->lfm->setName($file_name)->exists()) {
|
||||
return $this->response('error', parent::getError('move-exist'));
|
||||
}
|
||||
}
|
||||
if($working_dir){
|
||||
$new_file = $this->lfm->dir($working_dir)->pretty($file_name);
|
||||
}else{
|
||||
$new_file = $this->lfm->pretty($file_name);
|
||||
}
|
||||
|
||||
$new_file = $this->lfm->pretty($file_name);
|
||||
$working_folder_id = $new_file->getModelParentFolderId();
|
||||
$file_path = $new_file->path();
|
||||
|
||||
$file_path = $new_file->path();
|
||||
$thumbnailURL = "";
|
||||
if(isset($value['items'][0]['snippet']['thumbnails']['high']['url'])){
|
||||
$thumbnailURL = $value['items'][0]['snippet']['thumbnails']['high']['url'];
|
||||
}elseif (isset($value['items'][0]['snippet']['thumbnails']['default']['url'])){
|
||||
$thumbnailURL = $value['items'][0]['snippet']['thumbnails']['default']['url'];
|
||||
}elseif (isset($value['items'][0]['snippet']['thumbnails']['standard']['url'])){
|
||||
$thumbnailURL = $value['items'][0]['snippet']['thumbnails']['standard']['url'];
|
||||
}
|
||||
$content = [
|
||||
'id' => $youtube_video_id,
|
||||
'title' => $file_title_row,
|
||||
'description' => $file_description,
|
||||
'uploadDate' => isset($value['items'][0]['snippet']['publishedAt']) ? $value['items'][0]['snippet']['publishedAt'] : "",
|
||||
'duration' => isset($value['items'][0]['contentDetails']['duration']) ? $value['items'][0]['contentDetails']['duration'] : "",
|
||||
'thumbnailURL' => $thumbnailURL,
|
||||
];
|
||||
|
||||
|
||||
|
|
@ -124,8 +156,13 @@ class FileController extends LfmController
|
|||
|
||||
//thumbnails
|
||||
if(isset($value['items'][0]['snippet']['thumbnails']['standard']['url'])) {
|
||||
if($working_dir){
|
||||
$this->lfm->dir($working_dir)->makeThumbnailURL($file_title.".jpg", $value['items'][0]['snippet']['thumbnails']['standard']['url']);
|
||||
}else{
|
||||
$this->lfm->makeThumbnailURL($file_title.".jpg", $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));
|
||||
|
|
@ -143,13 +180,12 @@ class FileController extends LfmController
|
|||
]);
|
||||
|
||||
return parent::$success_response;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function readGoogleApi($videoId){
|
||||
|
||||
$googleApiUrl = 'https://www.googleapis.com/youtube/v3/videos?id=' . $videoId . '&key=' . $this->apikey . '&part=snippet';
|
||||
$googleApiUrl = 'https://www.googleapis.com/youtube/v3/videos?id=' . $videoId . '&key=' . $this->apikey . '&part=snippet,contentDetails';
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
|
|
|
|||
|
|
@ -57,4 +57,22 @@ class FolderController extends LfmController
|
|||
|
||||
return parent::$success_response;
|
||||
}
|
||||
|
||||
|
||||
public function makeFolder($working_dir, $folder_name, $type="")
|
||||
{
|
||||
//
|
||||
if(config('lfm.alphanumeric_directory')){
|
||||
$folder_name = $this->helper->sanitize($folder_name);
|
||||
}
|
||||
if(!$this->lfm->setName($folder_name)->dir($working_dir)->exists()){
|
||||
try {
|
||||
$this->lfm->setName($folder_name)->dir($working_dir)->createFolder();
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
return parent::$success_response;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class LfmItem
|
|||
private $lfm;
|
||||
private $helper;
|
||||
|
||||
private $columns = ['name', 'url', 'time', 'icon', 'color', 'is_file', 'is_image', 'thumb_url', 'size', 'dimension', 'content', 'identifier'];
|
||||
private $columns = ['name', 'url', 'time', 'icon', 'color', 'is_file', 'is_image', 'thumb_url', 'size', 'dimension', 'content', 'identifier', 'slug'];
|
||||
public $attributes = [];
|
||||
|
||||
public function __construct(LfmPath $lfm, Lfm $helper)
|
||||
|
|
@ -140,6 +140,12 @@ class LfmItem
|
|||
}
|
||||
}
|
||||
|
||||
public function slug()
|
||||
{
|
||||
if($this->model()){
|
||||
return $this->model()->slug;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function sizeRow()
|
||||
|
|
|
|||
|
|
@ -271,7 +271,6 @@ class LfmPath
|
|||
$path = $this->working_dir
|
||||
?: $this->helper->input('working_dir')
|
||||
?: $this->helper->getRootFolder();
|
||||
|
||||
if ($this->is_thumb) {
|
||||
$path .= Lfm::DS . $this->helper->getThumbFolderName();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\IqContent\LaravelFilemanager\Models\IQContentCategory whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property-read int|null $tags_count
|
||||
* @property string|null $identifier
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\IqContent\LaravelFilemanager\Models\IQContentCategory whereIdentifier($value)
|
||||
*/
|
||||
class IQContentCategory extends Model
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue