question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how can we style/scale the image displayed by <S3Image> component for React ?

See original GitHub issue

At the moment when I add the <S3Image> component with the following props: <S3Image imgKey={"somekey"} picker />

–> the image is displayed “as-is” (which can be MASSIVE in scale if image is large) and setting a style prop on the S3Image component didn’t seem to do anything. Nor did nesting the S3Image component inside a <div> and setting a style on that div.

How can we scale / resize the displayed image for this component ? Is there a different prop ?

Also why is nothing displayed in the large rectangle that houses the camera icon ? Is a massive waste of space/screen real estate. My suggestion is to let the user HIDE both the title section and that camera section via props. Then you’d have a nice clean display with a button to select, and a preview image that can be styled (per above; plus, perhaps set border radius to make into circle etc)

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

10reactions
RobertBrewitzcommented, Sep 16, 2018

Here’s the actual img style prop: https://github.com/aws-amplify/amplify-js/blob/7e07ebe66e9957c01c4d1fee190b48a2f33fff89/packages/aws-amplify-react/src/Storage/S3Image.js#L131

So probably <S3Image theme={{ photoImg: { width: '300px', height: '300px' } }} />

theme.photo seems to be the wrapper div styles around img theme.photoImg seems to be the img styles style overrides theme.photo

3reactions
jeremysandorcommented, Nov 14, 2018

Thank you for diving in @RobertBrewitz

<S3Image theme={{ photoImg: { width: '300px', height: '300px' } }} />

did the trick

Read more comments on GitHub >

github_iconTop Results From Across the Web

Storage - S3 Image - React - AWS Amplify Docs
Amplify S3 Image Component is used to upload and render an image from S3 bucket using an image key - React - AWS...
Read more >
How to include s3image inside ReactJs card - Stack Overflow
I was thinking to have something like from s3image to store values into a map and then iterate over and display the image...
Read more >
Build a photo gallery React app using Amplify Studio's new file ...
The S3Album component renders a list of images from an S3 bucket with a single line of code. There's only a few lines...
Read more >
Upload and resize images to the cloud with Aws S3, Amplify ...
Upload and resize images to the cloud with Aws S3, Amplify and React (Part 8). This story is part of a series about...
Read more >
AWS Amplify: Storage (Part 3) - sufle.io
Displaying Images. To display those images, we will use AmplifyS3Image component from @aws-amplify/ui-react library. Let's import it into our ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found