Signature upload: crop frame is fixed at 350×100 *image pixels*, so it is tiny on any real photo or scan

Open Beginner friendly
#9,526 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript
Domain
frontend

Research direction

Start in src/components/Draw/FileUpload.vue and read how defaultStencilSize is passed to vue-advanced-cropper; the issue explains that the object is interpreted in image pixels. Review FileUpload.spec.ts for the related tests and reproduce with a large uploaded image. Done when the initial crop frame covers most of the image while keeping the configured aspect ratio.

Written by the indexing model from the issue text.

Description

Describe the bug

In the signature dialog, tab "Upload", FileUpload.vue passes :default-size="defaultStencilSize" to vue-advanced-cropper. defaultStencilSize is computed from the cropper container width, but the library interprets an object passed as defaultSize as coordinates in image pixels, not screen pixels. For an uploaded image of 3000×1200 px the initial crop frame therefore covers only a few percent of the image (350×100 px of 3000×1200). The user sees a huge image with a minuscule selection and has to resize or zoom a lot before it makes sense. Many users give up at this step.

To reproduce
  1. Open LibreSign → account page (/apps/libresign/f/account) → "Signature" → create a new one.
  2. Select tab "Upload" and choose any image larger than about 1000 px wide (a phone photo or scan of a signature).
  3. Look at the crop frame.
Expected behavior

The initial crop frame covers most of the image (with the configured aspect ratio), as it does when no default-size is given.

Screenshots

Not attached. Measured in the browser with a 3000×1200 px PNG: frame 22×13 CSS px inside a 375×150 CSS px preview (before); 210×120 CSS px after removing :default-size (see below).

Operational System

macOS (headless Chrome 157, automation)

Browser Type and Version

Chrome 157

Libresign Version

15.0.12 (the code is identical on main: src/components/Draw/FileUpload.vue, defaultStencilSize)

Nextcloud Server Version

35.0.2

Logs from Nextcloud Server

Analysis
vue-advanced-cropper 2.8.9, resetCoordinates: if defaultSize is an object it is used directly as the stencil size in image coordinates; if it is not set, the library's own default (stencil covers the visible area) is used.

Possible fix
Drop the default-size binding (patch in upstream-fix.diff, based on main; the two unit tests for defaultStencilSize in FileUpload.spec.ts are removed with it, the suite was not run). Alternative if the "max base size" behavior is wanted: pass a function ({ imageSize }) => … that scales stencilBaseWidth/Height to a fraction of the image.

Logs from Developers tools

No response

Additional context

Analysis
vue-advanced-cropper 2.8.9, resetCoordinates: if defaultSize is an object it is used directly as the stencil size in image coordinates; if it is not set, the library's own default (stencil covers the visible area) is used.

Possible fix
Drop the default-size binding (patch in upstream-fix.diff, based on main; the two unit tests for defaultStencilSize in FileUpload.spec.ts are removed with it, the suite was not run). Alternative if the "max base size" behavior is wanted: pass a function ({ imageSize }) => … that scales stencilBaseWidth/Height to a fraction of the image.

Dominant language
PHP
Stars
844
Forks
176
Avg merge
14h 3m
Merged PRs (30d)
344

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from LibreSign/libresign

All issues in LibreSign/libresign

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.