Starting thumbnail generation logic

This commit is contained in:
tschneider 2020-02-15 12:04:15 +01:00
parent 3a01d6680f
commit 65ae3b1cb5
17 changed files with 301 additions and 21 deletions

View file

@ -19,7 +19,9 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/fideloper/proxy" />
<excludeFolder url="file://$MODULE_DIR$/vendor/filp/whoops" />
<excludeFolder url="file://$MODULE_DIR$/vendor/fzaninotto/faker" />
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/psr7" />
<excludeFolder url="file://$MODULE_DIR$/vendor/hamcrest/hamcrest-php" />
<excludeFolder url="file://$MODULE_DIR$/vendor/intervention/image" />
<excludeFolder url="file://$MODULE_DIR$/vendor/jakub-onderka/php-console-color" />
<excludeFolder url="file://$MODULE_DIR$/vendor/jakub-onderka/php-console-highlighter" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/framework" />
@ -50,9 +52,11 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-token-stream" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/phpunit" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/container" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-message" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/log" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/simple-cache" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psy/psysh" />
<excludeFolder url="file://$MODULE_DIR$/vendor/ralouphie/getallheaders" />
<excludeFolder url="file://$MODULE_DIR$/vendor/ramsey/uuid" />
<excludeFolder url="file://$MODULE_DIR$/vendor/scrivo/highlight.php" />
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/code-unit-reverse-lookup" />

View file

@ -93,6 +93,10 @@
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-util" />
<path value="$PROJECT_DIR$/vendor/tymon/jwt-auth" />
<path value="$PROJECT_DIR$/vendor/namshi/jose" />
<path value="$PROJECT_DIR$/vendor/intervention/image" />
<path value="$PROJECT_DIR$/vendor/ralouphie/getallheaders" />
<path value="$PROJECT_DIR$/vendor/psr/http-message" />
<path value="$PROJECT_DIR$/vendor/guzzlehttp/psr7" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.2" />

View file

@ -2,12 +2,20 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="eed7de89-f054-487c-bf59-36356758942b" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/public/upload/images/Ogga/Roblox_Dropper.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/public/upload/images/Papa_Schlumpf/Roblox_Dropper.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/config/image.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/public/upload/images/NeuerKram/Roblox_Dropper.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/public/upload/images/Superordner4/dsa.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/public/upload/images/Superordner5/Baronie_Nordhag.jpg" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/motorradig.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/motorradig.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/php.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/php.xml" 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.json" beforeDir="false" afterPath="$PROJECT_DIR$/composer.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/composer.lock" beforeDir="false" afterPath="$PROJECT_DIR$/composer.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/app.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/app.php" 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/views/Upload.vue" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/views/Upload.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/public/upload/images/Neuer:Kram/Roblox_Dropper.png" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -126,6 +134,10 @@
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-util" />
<path value="$PROJECT_DIR$/vendor/tymon/jwt-auth" />
<path value="$PROJECT_DIR$/vendor/namshi/jose" />
<path value="$PROJECT_DIR$/vendor/intervention/image" />
<path value="$PROJECT_DIR$/vendor/ralouphie/getallheaders" />
<path value="$PROJECT_DIR$/vendor/psr/http-message" />
<path value="$PROJECT_DIR$/vendor/guzzlehttp/psr7" />
</include_path>
</component>
<component name="ProjectId" id="1SsafifEzlSTXL72mt36RI9ZBHK" />
@ -237,9 +249,7 @@
<workItem from="1580891625747" duration="1061000" />
<workItem from="1580916835678" duration="1903000" />
<workItem from="1580969444691" duration="3286000" />
<workItem from="1581603105382" duration="36000" />
<workItem from="1581605243411" duration="107000" />
<workItem from="1581605492741" duration="1581000" />
<workItem from="1581761350796" duration="2791000" />
</task>
<servers />
</component>
@ -263,11 +273,10 @@
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
</component>
<component name="WindowStateProjectService">
<state x="1909" y="290" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog" timestamp="1581603136873">
<screen x="1280" y="23" width="1920" height="1057" />
<state x="419" y="219" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog" timestamp="1580891589354">
<screen x="0" y="23" width="1280" height="777" />
</state>
<state x="629" y="273" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1580564280549" />
<state x="1909" y="290" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog/0.23.1280.777/1280.23.1920.1057@1280.23.1920.1057" timestamp="1581603136873" />
<state x="419" y="219" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog/0.23.1280.777@0.23.1280.777" timestamp="1580891589354" />
<state x="1978" y="315" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1580917019448">
<screen x="1280" y="23" width="1920" height="1057" />
@ -277,20 +286,19 @@
<screen x="0" y="0" width="1920" height="1080" />
</state>
<state x="510" y="217" width="881" height="578" key="FileChooserDialogImpl/0.0.1920.1080@0.0.1920.1080" timestamp="1581069660293" />
<state x="1730" y="198" key="SettingsEditor" timestamp="1581415686371">
<state x="1730" y="198" key="SettingsEditor" timestamp="1580917895369">
<screen x="1280" y="23" width="1920" height="1057" />
</state>
<state x="450" y="179" key="SettingsEditor/0.0.1920.1080@0.0.1920.1080" timestamp="1580731664075" />
<state x="1730" y="198" key="SettingsEditor/0.23.1280.777/1280.23.1920.1057@1280.23.1920.1057" timestamp="1581415686371" />
<state x="1730" y="198" key="SettingsEditor/0.23.1280.777/1280.23.1920.1057@1280.23.1920.1057" timestamp="1580917895369" />
<state x="1280" y="23" width="1720" height="857" maximized="true" key="com.intellij.history.integration.ui.views.FileHistoryDialog" timestamp="1581075547973">
<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="1935" y="380" key="com.intellij.ide.util.TipDialog" timestamp="1581605507447">
<screen x="1280" y="23" width="1920" height="1057" />
<state x="655" y="365" key="com.intellij.ide.util.TipDialog" timestamp="1581761353338">
<screen x="0" y="0" width="1920" height="1080" />
</state>
<state x="655" y="365" key="com.intellij.ide.util.TipDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1580726765734" />
<state x="1935" y="380" key="com.intellij.ide.util.TipDialog/0.23.1280.777/1280.23.1920.1057@1280.23.1920.1057" timestamp="1581605507447" />
<state x="655" y="365" key="com.intellij.ide.util.TipDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1581761353338" />
<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

@ -8,16 +8,17 @@ use Log;
use App\File;
use App\Folder;
use Image;
class FileController extends Controller
{
public function upload(Request $request) {
Log::info("Incoming UploadRequest");
$uploadedFile=$request->image;
$folder=$request->folder;
$thumbFolder=$folder."/thumbnail";
Log::info("Folder: '".$folder."'");
$f=Folder::where('name',$folder)->first();
@ -30,6 +31,14 @@ class FileController extends Controller
$f->name = $uploadedFile->getClientOriginalName();
$f->save();
//////////////////////
$thumbnailImage = Image::make($uploadedFile);
$thumbnailImage->resize(128,128);
Log::info("ThumbDir: ".$thumbFolder);
mkdir($thumbFolder);
$thumbnailImage->save($thumbFolder."/".$uploadedFile->getClientOriginalName());
//////////////////////
return response(['status'=>'success','storedName'=>$filename],200);
}

View file

@ -10,6 +10,7 @@
"require": {
"php": "^7.2",
"fideloper/proxy": "^4.0",
"intervention/image": "^2.5",
"laravel/framework": "^6.2",
"laravel/tinker": "^1.0",
"laravel/ui": "^1.1",

233
motorradig/composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "982e21cc64e27987a84fe2d0caa51fa9",
"content-hash": "51e1d6e28388624bdaae0205b929d2bf",
"packages": [
{
"name": "dnoegel/php-xdg-base-dir",
@ -380,6 +380,147 @@
],
"time": "2019-09-03T16:45:42+00:00"
},
{
"name": "guzzlehttp/psr7",
"version": "1.6.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "239400de7a173fe9901b9ac7c06497751f00727a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a",
"reference": "239400de7a173fe9901b9ac7c06497751f00727a",
"shasum": ""
},
"require": {
"php": ">=5.4.0",
"psr/http-message": "~1.0",
"ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
},
"provide": {
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"ext-zlib": "*",
"phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
},
"suggest": {
"zendframework/zend-httphandlerrunner": "Emit PSR-7 responses"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.6-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Tobias Schultze",
"homepage": "https://github.com/Tobion"
}
],
"description": "PSR-7 message implementation that also provides common utility methods",
"keywords": [
"http",
"message",
"psr-7",
"request",
"response",
"stream",
"uri",
"url"
],
"time": "2019-07-01T23:21:34+00:00"
},
{
"name": "intervention/image",
"version": "2.5.1",
"source": {
"type": "git",
"url": "https://github.com/Intervention/image.git",
"reference": "abbf18d5ab8367f96b3205ca3c89fb2fa598c69e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Intervention/image/zipball/abbf18d5ab8367f96b3205ca3c89fb2fa598c69e",
"reference": "abbf18d5ab8367f96b3205ca3c89fb2fa598c69e",
"shasum": ""
},
"require": {
"ext-fileinfo": "*",
"guzzlehttp/psr7": "~1.1",
"php": ">=5.4.0"
},
"require-dev": {
"mockery/mockery": "~0.9.2",
"phpunit/phpunit": "^4.8 || ^5.7"
},
"suggest": {
"ext-gd": "to use GD library based image processing.",
"ext-imagick": "to use Imagick based image processing.",
"intervention/imagecache": "Caching extension for the Intervention Image library"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
},
"laravel": {
"providers": [
"Intervention\\Image\\ImageServiceProvider"
],
"aliases": {
"Image": "Intervention\\Image\\Facades\\Image"
}
}
},
"autoload": {
"psr-4": {
"Intervention\\Image\\": "src/Intervention/Image"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Oliver Vogel",
"email": "oliver@olivervogel.com",
"homepage": "http://olivervogel.com/"
}
],
"description": "Image handling and manipulation library with support for Laravel integration",
"homepage": "http://image.intervention.io/",
"keywords": [
"gd",
"image",
"imagick",
"laravel",
"thumbnail",
"watermark"
],
"time": "2019-11-02T09:15:47+00:00"
},
{
"name": "jakub-onderka/php-console-color",
"version": "v0.2",
@ -1341,6 +1482,56 @@
],
"time": "2017-02-14T16:28:37+00:00"
},
{
"name": "psr/http-message",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"time": "2016-08-06T14:39:51+00:00"
},
{
"name": "psr/log",
"version": "1.1.1",
@ -1510,6 +1701,46 @@
],
"time": "2018-10-13T15:16:03+00:00"
},
{
"name": "ralouphie/getallheaders",
"version": "3.0.3",
"source": {
"type": "git",
"url": "https://github.com/ralouphie/getallheaders.git",
"reference": "120b605dfeb996808c31b6477290a714d356e822"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
"reference": "120b605dfeb996808c31b6477290a714d356e822",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^5 || ^6.5"
},
"type": "library",
"autoload": {
"files": [
"src/getallheaders.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ralph Khattar",
"email": "ralph.khattar@gmail.com"
}
],
"description": "A polyfill for getallheaders.",
"time": "2019-03-08T08:55:37+00:00"
},
{
"name": "ramsey/uuid",
"version": "3.8.0",

View file

@ -175,6 +175,8 @@ return [
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Intervention\Image\ImageServiceProvider::class,
],
/*
@ -207,6 +209,7 @@ return [
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Image' => Intervention\Image\Facades\Image::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,

View file

@ -0,0 +1,20 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Image Driver
|--------------------------------------------------------------------------
|
| Intervention Image supports "GD Library" and "Imagick" to process images
| internally. You may choose one of them according to your PHP
| configuration. By default PHP's "GD Library" implementation is used.
|
| Supported: "gd", "imagick"
|
*/
'driver' => 'gd'
];

View file

@ -391,7 +391,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(/*! /Users/tschneider/dev/repo/motorradig/motorradig/resources/js/Icon.js */"./resources/js/Icon.js");
module.exports = __webpack_require__(/*! /mnt/d/repos/motorradig/motorradig/resources/js/Icon.js */"./resources/js/Icon.js");
/***/ })

View file

@ -49217,8 +49217,8 @@ __webpack_require__.r(__webpack_exports__);
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(/*! /Users/tschneider/dev/repo/motorradig/motorradig/resources/js/app.js */"./resources/js/app.js");
module.exports = __webpack_require__(/*! /Users/tschneider/dev/repo/motorradig/motorradig/resources/sass/app.scss */"./resources/sass/app.scss");
__webpack_require__(/*! /mnt/d/repos/motorradig/motorradig/resources/js/app.js */"./resources/js/app.js");
module.exports = __webpack_require__(/*! /mnt/d/repos/motorradig/motorradig/resources/sass/app.scss */"./resources/sass/app.scss");
/***/ })

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB