Closed miriam-aha closed 1 year ago
Explore https://imagekit.io/ to center the image of a person-profile to the face of a person
Selection of free cropper libraries that can do the work:
react-avatar-editor: lightweight library cropping tool with zero dependencies.
react-easy-crop: react component for easily cropping images.
Other (in vanilla JS)
cropperjs : one of the most used. When hovering over the uploaded image you can scroll in and out using your mouse wheel to zoom. This also supports pinching and touch-based input devices.
smartcrop.js: it has its own proprietary algorithm to recognize faces, compositions, and define a “good crop” after you click the upload button.
Croppie: minimalist.
Thanks @pilauria. I'll review them tomorrow to add my two cents to the discussion.
Selection of free cropper libraries that can do the work:
- react-cropper
- react-image-crop
- react-avatar-editor: lightweight library cropping tool with zero dependencies.
- react-easy-crop: react component for easily cropping images.
- react-drop-n-crop: combo plugin of two different scripts: the dropzone library to handle image uploads along with the React Cropper as an image cropping React component.
Other (in vanilla JS)
- cropperjs : one of the most used. When hovering over the uploaded image you can scroll in and out using your mouse wheel to zoom. This also supports pinching and touch-based input devices.
- smartcrop.js: it has its own proprietary algorithm to recognize faces, compositions, and define a “good crop” after you click the upload button.
- Tinycrop
- Croppie: minimalist.
Great stuff @pilauria. I think all of them would work for us but I especially liked two of them as they are really intuitive to use and also easy to implement:
If @ericbolikowski also agrees, we can simply pick one of them and start implementing. However, since our current flow doesn't have an extra step of image cropping, we need to introduce a UI to allow users to do this. My recommendation would be this:
Note:
react-avatar-editor
seems to be supporting a file input out of the box. That's great. react-easy-crop
instead expects a string which might force us to add an extra step of converting the selected file into a string somehow. So, react-avatar-editor
is a tiny bit forward in the race of options for me :)
Ok, @helloanil, thanks for the feedback. We'll tackle the problem as soon as @ericbolikowski checks out your inputs👍🏽
My vote goes with react-easy-crop
:
{cropShape: 'round'}
feature that results in "circular cropping", letting the user preview exactly what kind of circular photo their profile will haveI think there's basically two ways to integrate with what we've already got:
Beware, I think option number 2 here would be tricky to integrate with the uploader mechanism we're using (react-s3-uploader). That is abandonware by now, and I recall it being hard to work with. Simply looking at the props it accepts, here's some speculation about how we might make it work:
preprocess
prop to register a function that stops default behaviour on selecting a file, instead triggering the cropper component<label for="">
technique). Click event => preprocess
is triggered again (I suppose) => do the cropping, return new image => react-s3-uploader handles the rest, and via existing hooks (e.g. onProgress
, onError
, onFinish
) we handle different outcomesAgain - this is speculation. Recommend some quick prototyping to figure out if the above is feasible or not. Worst case scenario is that we have to drop react-s3-uploader
completely, replacing it with one of these:
react-s3-uploader
into a lib in our monorepo and tweak its source code to fit our needsWe need to ask companies to use another logo (this happens on LinkedIn too)
We have a new design of the mentor/mentee profile cards to be implemented in #681.
Context/background
Currently, when users upload their pictures to ReDI Connect or Talent Pool, they are automatically cropped by the system resulting in many headless mentors or other unfortunate views in their profile cards.
This issue affects the following cases:
What needs to be done?