8000 expand image to fit container · Issue #600 · dominictobias/react-image-crop · GitHub
[go: up one dir, main page]

Skip to content

expand image to fit container #600

Open

Description

@tonypeng

as mentioned in #108, i've set a width on the parent container:

<div style={{width: 400}}>
  <ReactCrop ...>
    <img ... />
  </ReactCrop>
</div>

This works well when the image is larger than the container (the image is resized downward to fit in the container), but when the image is smaller than the container, it doesn't scale up to fit the container. Any way to accomplish this behavior?

Activity

  1. ayushgarg-git commented on Sep 2, 2024

    @ayushgarg-git

    Hey @tonypeng
    I used the "style" prop to specify width and height of the Crop container and added {width:"100%",height:"100%", objectFit:'contain'} as the style for the enclosed image. The image expands to the size that you specify for the Cropper nicely.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0