-
Notifications
You must be signed in to change notification settings - Fork 920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented 'Image' field. Added 'cropper' dependancy. #56
Conversation
@deslittle , I am SO SO SORRY for not replying sooner. I archived the email thinking I'd remember to reply the same day, but apparently I forgot. This is SO COOL. Thanks a lot for the work, I've tried it and it looks and works great. However, I don't think storing images in the database is a good idea for most people. It might be for a few use cases, so it might be the right technical solution for your project, but I think if we include this in the core as the only "image" field type, a lot of developers will store them that way, and we'd be making a niche practice mainstream. So here's what I propose, if you're ok with it:
Making these two fields available at the same time will both:
What do you think, is it ok if I do that? Thanks a lot, your work is great and seeing people like you contribute really makes all this effort worthwhile. And sorry again for the delay... Cheers! |
Haha no problem at all. This was actually my first open source contribution so I wasn't sure if I had done something wrong. I agree it's generally not a good idea to store images in the DB and as I mentioned above you quickly run into problems the larger the images get. Good idea splitting the fields into Thanks for the great library! I was able to get up my admin area up and running in just a couple of hours. I particularly like the modular design and how it stays out of my main app logic while allowing me to override certain views as I need to. Keep up the good work! |
+1 for this feature, very useful. |
Update: still haven't gotten the time to create the Cheers! |
base64_image store 4-5 times larger than original image size. I have jpg image 16kb size and after crop and save on DB it got 90kb size. |
Usage:
Images are submitted in base64 format. In my basic tests images may be 1.5 to 3 times larger than the original.
When saving directly to DB (e.g. MySQL) make sure you set the field type to 'LONGBLOB' and increase the limits on form uploads: e.g. mysqld --innodb_log_file_size=1G --max_allowed_packet=100MB
Alternatively you can intercept the 'image' request field and save to alternate location. e.g. in CRUD controller 'update' or 'store' (Using the 'Intervention' and 'Laravel-MediaLibrary' packages):
And then retrieve the media on edit. e.g. in User Model:
And set up a route and controller:
Route::get('media/user/{user}/{collection}', 'UserMediaController@getMedia');