Commit 726d30ef authored by ZeMKI's avatar ZeMKI
Browse files

Merge branch 'master' into Production

parents 587c0f29 94b7b32a
......@@ -125,9 +125,9 @@ class InterviewController extends Controller
$interview->author = Auth::user()->id;
$interview->interviewed = $request->input('interviewed');
$this->storeSortingScreenshot($request, $name);
$this->storeSortingScreenshot($request, $study, $name);
$interview->sorting_screenshot = storage_path('app/screenshots/' . $name . '.mscreenshot');
$interview->sorting_screenshot = storage_path('app/study' . $study->id . '/screenshots/' . $name . '.mscreenshot');
$interview->start = $request->input('time_start');
$interview->end = $request->input('time_end');
$interview->save();
......@@ -184,21 +184,25 @@ class InterviewController extends Controller
* @param Request $request
* @param $name
*/
public function storeSortingScreenshot(Request $request, &$name): void
public function storeSortingScreenshot(Request $request, Study $study, &$name): void
{
$image = $request->input('sortingscreenshot');
$name = "interview_" . $request->input('time_start');
$arr = explode(",", $request->input('sortingscreenshot'), 2);
$base64firstpart = $arr[0];
$studyPath = storage_path('app/study' . $study->id . '/screenshots/');
File::isDirectory($studyPath) or File::makeDirectory($studyPath, 0775, true, true);
$extension = $this->extension($request->input('sortingscreenshot'));
$path = storage_path('app/screenshots/' . $name . "." . $extension);
$path = $studyPath . $name . "." . $extension;
// open file a image resource
\Image::make($image)->save($path);
$path = storage_path('app/screenshots/' . $name . "." . $extension);
$encryptedContent = encrypt($base64firstpart . "," . base64_encode(file_get_contents($path)));
// Store the encrypted Content
Storage::put('screenshots/' . $name . '.mscreenshot', $encryptedContent);
Storage::put('study' . $study->id . '/screenshots/' . $name . '.mscreenshot', $encryptedContent);
File::delete($path);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment