コミット
fef53a163a
|
@ -10,8 +10,6 @@ use Illuminate\Support\Facades\DB;
|
|||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
use Image;
|
||||
|
||||
use App\Models\Child;
|
||||
use App\Models\FatherRelation;
|
||||
use App\Models\MeetingApprovals;
|
||||
|
@ -159,11 +157,7 @@ class ChildrenController extends Controller {
|
|||
if (!is_null($r->image)) {
|
||||
$image = base64_decode(substr($r->image, strpos($r->image, ',') + 1));
|
||||
Storage::disk('private')->put($filename, $image);
|
||||
|
||||
$quality = 1;
|
||||
$img = Image::make('/work/storage/app/private/'.$filename)->encode('jpg', $quality);
|
||||
$img->orientate();
|
||||
$img->save('/work/storage/app/private/'.$filename);
|
||||
$this->fiximg($filename);
|
||||
}
|
||||
|
||||
$child->fill($insert);
|
||||
|
@ -419,11 +413,7 @@ class ChildrenController extends Controller {
|
|||
|
||||
$image = base64_decode(substr($r->image, strpos($r->image, ',') + 1));
|
||||
Storage::disk('private')->put($filename, $image);
|
||||
|
||||
$quality = 1;
|
||||
$img = Image::make('/work/storage/app/private/'.$filename)->encode('jpg', $quality);
|
||||
$img->orientate();
|
||||
$img->save('/work/storage/app/private/'.$filename);
|
||||
$this->fiximg($filename);
|
||||
|
||||
$child = Child::find((int)$child_id);
|
||||
if (!is_null($child->image) && $child->image != '/assets/default/avatar.jpg') {
|
||||
|
|
|
@ -11,8 +11,6 @@ use Illuminate\Support\Facades\Log;
|
|||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
use Image;
|
||||
|
||||
use App\Models\Father;
|
||||
use App\Models\FatherRelation;
|
||||
use App\Models\EmailActivation;
|
||||
|
@ -182,11 +180,7 @@ class FathersController extends Controller {
|
|||
$filename = $this->uuidv4().'.jpg';
|
||||
$image = base64_decode(substr($r->image, strpos($r->image, ',') + 1));
|
||||
Storage::disk('private')->put($filename, $image);
|
||||
|
||||
$quality = 1;
|
||||
$img = Image::make('/work/storage/app/private/'.$filename)->encode('jpg', $quality);
|
||||
$img->orientate();
|
||||
$img->save('/work/storage/app/private/'.$filename);
|
||||
$this->fiximg($filename);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -356,11 +350,7 @@ class FathersController extends Controller {
|
|||
|
||||
$image = base64_decode(substr($r->image, strpos($r->image, ',') + 1));
|
||||
Storage::disk('private')->put($filename, $image);
|
||||
|
||||
$quality = 1;
|
||||
$img = Image::make('/work/storage/app/private/'.$filename)->encode('jpg', $quality);
|
||||
$img->orientate();
|
||||
$img->save('/work/storage/app/private/'.$filename);
|
||||
$this->fiximg($filename);
|
||||
|
||||
$father = Father::find((int)$father_id);
|
||||
if (!is_null($father->image) && $father->image != '/assets/default/avatar.jpg') {
|
||||
|
|
|
@ -8,8 +8,6 @@ use Illuminate\Http\Request;
|
|||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
use Image;
|
||||
|
||||
use App\Models\MeetingImage;
|
||||
|
||||
class MeetingImagesController extends Controller {
|
||||
|
@ -52,10 +50,7 @@ class MeetingImagesController extends Controller {
|
|||
$fname[] = $filename;
|
||||
$image = base64_decode(substr($img, strpos($img, ',') + 1));
|
||||
Storage::disk('private')->put($filename, $image);
|
||||
$quality = 1;
|
||||
$imag = Image::make('/work/storage/app/private/'.$filename)->encode('jpg', $quality);
|
||||
$img->orientate();
|
||||
$imag->save('/work/storage/app/private/'.$filename);
|
||||
$this->fiximg($filename);
|
||||
|
||||
$insert = [
|
||||
'meeting_id' => (int)$r->meeting_id,
|
||||
|
|
|
@ -9,8 +9,6 @@ use Illuminate\Support\Facades\DB;
|
|||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
use Image;
|
||||
|
||||
use App\Models\Meeting;
|
||||
use App\Models\MeetingImage;
|
||||
use App\Models\MeetingApprovals;
|
||||
|
@ -122,10 +120,7 @@ class MeetingsController extends Controller {
|
|||
$fnames[] = $fname;
|
||||
$image = base64_decode(substr($img, strpos($img, ',') + 1));
|
||||
Storage::disk('private')->put($fname, $image);
|
||||
$quality = 1;
|
||||
$imag = Image::make('/work/storage/app/private/'.$fname)->encode('jpg', $quality);
|
||||
$imag->orientate();
|
||||
$imag->save('/work/storage/app/private/'.$fname);
|
||||
$this->fiximg($filename);
|
||||
|
||||
$imgname = '/files/'.$fname;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ use Illuminate\Foundation\Bus\DispatchesJobs;
|
|||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Image;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
|
@ -160,4 +161,24 @@ class Controller extends BaseController
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function fiximg ($filename, $quality=1) {
|
||||
$img = Image::make('/work/storage/app/private/'.$filename)->encode('jpg', $quality);
|
||||
$img->orientate();
|
||||
if ($img->width() < $img->height() && $img->width() > 400) {
|
||||
$img->resize(400, null, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
});
|
||||
}
|
||||
else if ($img->height() < $img->width() && $img->height() > 400) {
|
||||
$img->resize(400, null, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
});
|
||||
}
|
||||
$img->save('/work/storage/app/private/'.$filename);
|
||||
|
||||
return $filename;
|
||||
}
|
||||
}
|
||||
|
|
新しいイシューから参照