mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Fix image processing when editing an existing asset. Also reenable the image scaling on the server, but boost limit to 800x800
This commit is contained in:
parent
b3454b1c24
commit
3ddaa88694
|
@ -218,12 +218,10 @@ class AssetsController extends Controller
|
||||||
$path = public_path('uploads/assets/'.$file_name);
|
$path = public_path('uploads/assets/'.$file_name);
|
||||||
|
|
||||||
//Currently resizing happens on Client. Maybe use this for thumbnails in the future?
|
//Currently resizing happens on Client. Maybe use this for thumbnails in the future?
|
||||||
Image::make($image)
|
Image::make($image)->resize(500, 500, function ($constraint) {
|
||||||
->resize(500, 500, function ($constraint) {
|
|
||||||
$constraint->aspectRatio();
|
$constraint->aspectRatio();
|
||||||
$constraint->upsize();
|
$constraint->upsize();
|
||||||
})
|
})->save($path);
|
||||||
->save($path);
|
|
||||||
$asset->image = $file_name;
|
$asset->image = $file_name;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -370,11 +368,17 @@ class AssetsController extends Controller
|
||||||
$asset->physical = '1';
|
$asset->physical = '1';
|
||||||
|
|
||||||
// Update the image
|
// Update the image
|
||||||
if (Input::file('image')) {
|
if (Input::has('image')) {
|
||||||
$image = Input::file('image');
|
$image = Input::get('image');
|
||||||
$file_name = str_random(25).".".$image->getClientOriginalExtension();
|
$header = explode(';', $image, 2)[0];
|
||||||
|
$extension = substr( $header, strpos($header, '/')+1);
|
||||||
|
$image = substr( $image, strpos($image, ',')+1);
|
||||||
|
|
||||||
|
$file_name = str_random(25).".".$extension;
|
||||||
$path = public_path('uploads/assets/'.$file_name);
|
$path = public_path('uploads/assets/'.$file_name);
|
||||||
Image::make($image->getRealPath())->resize(500, null, function ($constraint) {
|
|
||||||
|
|
||||||
|
Image::make($image)->resize(500, 500, function ($constraint) {
|
||||||
$constraint->aspectRatio();
|
$constraint->aspectRatio();
|
||||||
$constraint->upsize();
|
$constraint->upsize();
|
||||||
})->save($path);
|
})->save($path);
|
||||||
|
|
Loading…
Reference in a new issue