Skip to content

setImageSrc(String) keeps the cropped image of the previous source #38

Closed

Description

@paodb

Describe the bug

After changing the image with setImageSrc(String), getCroppedImageDataUri() (and getCroppedImageBase64()) still return the value from the previous image until the user crops the new one.

Expected behavior

Changing the image source should reset the cropped image, consistently with the constructor: ImageCrop(String) initializes it to the image source itself.

Minimal reproducible example

ImageCrop imageCrop = new ImageCrop("images/first.png");
imageCrop.setImageSrc("images/second.png");
imageCrop.getCroppedImageDataUri(); // returns "images/first.png"

Add-on Version

1.3.0

Vaadin Version

24.8.4

Additional information

Found while reviewing #37, where the equivalent case for the new setImageSrc(DownloadHandler) was fixed.

Activity

  1. moved this from Inbox (needs triage) to To Do in Flowing Code Addonson Oct 14, 2026
  2. paodb commented on Oct 14, 2026

    @paodb
    MemberAuthor

    Related, also pre-existing (found by @javier-godoy while reviewing #37): the String constructor stores the image URL in croppedImageDataUri, so new ImageCrop("images/empty-plant.png").getCroppedImageBase64() tries to Base64-decode a URL and throws IllegalArgumentException. ImageCrop(DownloadHandler) returns null in the same situation, so the two constructors disagree.

  3. moved this from To Do to In Progress in Flowing Code Addonson Oct 16, 2026
  4. added 2 commits that reference this issue on Oct 21, 2026
    9034aaf
    7e31a1c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions