Wrapped php mkdir() in is_dir check in FileController

This commit is contained in:
Torsten 2020-02-19 11:34:38 +01:00
parent bded5c06b2
commit fa3929377a
13 changed files with 27 additions and 11 deletions

View file

@ -2,15 +2,13 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="eed7de89-f054-487c-bf59-36356758942b" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/resources/js/views/Gallery.vue" afterDir="false" />
<change afterPath="$PROJECT_DIR$/public/upload/images/Superordner2/Roblox_Dropper.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/public/upload/images/Superordner2/thumbnail/Roblox_Dropper.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/FileController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/FileController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/composer.lock" beforeDir="false" afterPath="$PROJECT_DIR$/composer.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/public/js/Icon.js" beforeDir="false" afterPath="$PROJECT_DIR$/public/js/Icon.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/public/js/app.js" beforeDir="false" afterPath="$PROJECT_DIR$/public/js/app.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/js/routes.js" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/routes.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/js/views/Main.vue" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/views/Main.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/routes/api.php" beforeDir="false" afterPath="$PROJECT_DIR$/routes/api.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/js/views/Gallery.vue" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/views/Gallery.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/js/views/Upload.vue" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/views/Upload.vue" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -247,6 +245,8 @@
<workItem from="1581761350796" duration="2791000" />
<workItem from="1581843962263" duration="5279000" />
<workItem from="1581857706961" duration="672000" />
<workItem from="1582013508305" duration="204000" />
<workItem from="1582103369899" duration="2047000" />
</task>
<servers />
</component>
@ -292,11 +292,12 @@
<screen x="0" y="0" width="1920" height="1080" />
</state>
<state x="1280" y="23" width="1720" height="857" maximized="true" key="com.intellij.history.integration.ui.views.FileHistoryDialog/0.23.1280.777/1280.23.1920.1057@1280.23.1920.1057" timestamp="1580282545601" />
<state x="524" y="292" key="com.intellij.ide.util.TipDialog" timestamp="1581857707207">
<screen x="0" y="0" width="1536" height="864" />
<state x="1935" y="380" key="com.intellij.ide.util.TipDialog" timestamp="1582103371520">
<screen x="1280" y="23" width="1920" height="1057" />
</state>
<state x="524" y="292" key="com.intellij.ide.util.TipDialog/0.0.1536.864@0.0.1536.864" timestamp="1581857707207" />
<state x="655" y="365" key="com.intellij.ide.util.TipDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1581761353338" />
<state x="1935" y="380" key="com.intellij.ide.util.TipDialog/0.23.1280.777/1280.23.1920.1057@1280.23.1920.1057" timestamp="1582103371520" />
<state x="623" y="178" width="673" height="724" key="find.popup" timestamp="1580465329892">
<screen x="0" y="0" width="1920" height="1080" />
</state>

View file

@ -37,8 +37,10 @@ class FileController extends Controller
//////////////////////
$thumbnailImage = Image::make($uploadedFile);
$thumbnailImage->resize(128,128);
Log::info("ThumbDir: ".$thumbFolder);
mkdir($thumbFolder);
if (!is_dir($thumbFolder)) { mkdir($thumbFolder); }
$thumbnailImage->save($thumbFolder."/".$uploadedFile->getClientOriginalName());
//////////////////////

View file

@ -2105,6 +2105,7 @@ __webpack_require__.r(__webpack_exports__);
var folder = res.data.folders[i].folder_name;
var file = res.data.folders[i].file_name;
console.log('http://localhost:8000/upload/images/' + folder + "/" + file);
console.log('http://localhost:8000/upload/images/' + folder + "/thumbnail/" + file);
}
});
},
@ -2380,10 +2381,10 @@ __webpack_require__.r(__webpack_exports__);
});
},
uploadFile: function uploadFile(event) {
console.log("File changed:");
console.log(event.target.files[0].name);
var selectedFile = event.target.files[0];
var selectedFolder = this.$store.state.selectedFolder;
console.log("Uploading file " + selectedFile.name + " to folder " + selectedFolder);
var formData = new FormData(); //formData.append('image',selectedFile,selectedFile.name);
formData.append('image', selectedFile);
@ -2429,6 +2430,10 @@ __webpack_require__.r(__webpack_exports__);
console.log("Receiving folders");
console.log(res.data.folders);
_this3.$store.state.folders = res.data.folders;
if (_this3.$store.state.selectedFolder === 'default') {
_this3.$store.state.selectedFolder === res.data.folders[0];
}
});
},
newFolderSelected: function newFolderSelected(event) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -186,6 +186,7 @@
var folder=res.data.folders[i].folder_name;
var file =res.data.folders[i].file_name;
console.log('http://localhost:8000/upload/images/'+folder+"/"+file);
console.log('http://localhost:8000/upload/images/'+folder+"/thumbnail/"+file);
}
})

View file

@ -143,10 +143,14 @@
)
},
uploadFile(event) {
console.log("File changed:");
console.log(event.target.files[0].name);
var selectedFile=event.target.files[0];
var selectedFolder = this.$store.state.selectedFolder;
console.log("Uploading file "+selectedFile.name+" to folder "+selectedFolder);
const formData = new FormData();
//formData.append('image',selectedFile,selectedFile.name);
formData.append('image',selectedFile);
@ -192,6 +196,9 @@
console.log("Receiving folders");
console.log(res.data.folders);
this.$store.state.folders=res.data.folders;
if (this.$store.state.selectedFolder==='default') {
this.$store.state.selectedFolder===res.data.folders[0];
}
})
},
newFolderSelected(event) {