feat(profile): crop avatar/logo before upload (round mask by default)#131
Open
dantaspaulo wants to merge 1 commit into
Open
feat(profile): crop avatar/logo before upload (round mask by default)#131dantaspaulo wants to merge 1 commit into
dantaspaulo wants to merge 1 commit into
Conversation
Avatar/logo upload was raw: any aspect ratio went straight to the server, so
the circular avatar ended up off-center. Since the avatar/logo also renders as a
circle on generated cards, letting the user frame it improves the result a lot.
Selecting a file now opens an ImageCropperDialog (zoom + drag) with a round mask
by default; Save produces a canvas.toBlob -> File that gets uploaded already
cropped and resized (512x512 output, well under the 2 MB limit). The integration
lives in one place, PhotoUpload.vue, used by both the profile avatar and the
workspace logo. The cropper mounts only after the dialog has its final layout,
otherwise the circular stencil degrades into a square inside the modal.
Adds the vue-advanced-cropper dependency.
- ImageCropperDialog.vue (new): the crop modal (vue-advanced-cropper, CircleStencil).
- PhotoUpload.vue: opens the crop before uploading.
- lang/{en,es,pt-BR}/common.php: photo_upload.crop_* strings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Avatar/logo upload is raw: any aspect ratio goes straight to the server, so the
circular avatar ends up off-center. Since the avatar/logo also renders as a
circle on generated cards, letting the user frame it improves the result a lot.
Change
Selecting a file now opens an
ImageCropperDialog(zoom + drag) with a roundmask by default. Save produces a
canvas.toBlob→Filethat is uploadedalready cropped and resized (512×512 output, well under the 2 MB limit).
The integration lives in one place —
PhotoUpload.vue, used by both the profileavatar and the workspace logo. The cropper mounts only after the dialog has its
final layout, otherwise the circular stencil degrades into a square inside the
modal.
ImageCropperDialog.vue(new) — the crop modal (CircleStencil,RectangleStencilfor a square shape).PhotoUpload.vue— opens the crop before uploading.lang/{en,es,pt-BR}/common.php—photo_upload.crop_*strings.New dependency
This adds
vue-advanced-cropper(^2.8.9). It's a mature, Vue 3-compatiblecropper; the
package-lock.jsonchange is limited to that subtree(
classnames,debounce,easy-bem,vue-advanced-cropper). Happy to swap itfor another cropper if you'd prefer a different one.