Skip to content

feat(profile): crop avatar/logo before upload (round mask by default)#131

Open
dantaspaulo wants to merge 1 commit into
trypostit:mainfrom
dantaspaulo:feat/avatar-logo-crop
Open

feat(profile): crop avatar/logo before upload (round mask by default)#131
dantaspaulo wants to merge 1 commit into
trypostit:mainfrom
dantaspaulo:feat/avatar-logo-crop

Conversation

@dantaspaulo

Copy link
Copy Markdown

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 round
mask by default
. Save produces a canvas.toBlobFile that is uploaded
already cropped and resized (512×512 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.

  • ImageCropperDialog.vue (new) — the crop modal (CircleStencil, RectangleStencil for a square shape).
  • PhotoUpload.vue — opens the crop before uploading.
  • lang/{en,es,pt-BR}/common.phpphoto_upload.crop_* strings.

New dependency

This adds vue-advanced-cropper (^2.8.9). It's a mature, Vue 3-compatible
cropper; the package-lock.json change is limited to that subtree
(classnames, debounce, easy-bem, vue-advanced-cropper). Happy to swap it
for another cropper if you'd prefer a different one.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant