Skip to content

docs: show how to display an image from a byte array - #6264

Merged
vursen merged 3 commits into
mainfrom
docs/grid-byte-array-image
Oct 5, 2026
Merged

vursen merged 3 commits into
mainfrom
docs/grid-byte-array-image

Conversation

@totally-not-ai

@totally-not-ai totally-not-ai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review risk: two-way door: docs only. It adds one short section to the Add Images and Icons how-to.

Summary

Adds an Images from Byte Arrays section to articles/building-apps/ui-basics/add-images-icons.adoc. It shows how to display an image stored as a byte array, such as a profile picture loaded from a database. Until now the Image(byte[], …) constructors weren't documented anywhere.

What changed

  • Example of new Image(byte[], String). The second argument is a file name: its extension determines the MIME type, and it also becomes the default alt text, so the example sets a descriptive alt text with setAlt().
  • Example of the three-argument constructor new Image(byte[], String, String), for when the file name has no recognizable extension or the MIME type is stored separately.
  • The data is served to the browser through a DownloadHandler, as explained in the section above it.

Test summary

  • The Image(byte[], String) constructor was compiled against the docs project's Vaadin version. The snippets are inline.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Preview Deployment

This PR has been deployed for preview.

URL: https://docs-preview-pr-6264.fly.dev

Changed pages

Added content is highlighted in green; removed content is marked in red on each page.

Built from 2f6f267

Moves the byte-array image example from the Grid renderers page to the
Add Images and Icons how-to, where it stands on its own without a Grid.
The example now passes a file name with an extension so that the MIME
type is detected, and sets the alternative text explicitly.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vursen vursen changed the title docs: show how to render a byte-array image in a Grid cell docs: show how to display an image from a byte array Oct 5, 2026
@vursen

vursen commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

I moved the example from the Grid renderers page to the Add Images and Icons how-to. The only Grid-specific part was addComponentColumn(), which that section already covers, and the Image(byte[], String) constructor was not documented anywhere else, so the how-to is a better home for it.

While moving it, I also fixed the example. The second constructor argument is the image name, not the alt text: its extension is used to guess the MIME type, and it becomes the alt text only by default. The example now passes a file name with an extension, sets the alt text with setAlt(), and shows the three-argument constructor for an explicit MIME type. The refreshItem() note was Grid-specific and went away with the move.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vursen
vursen marked this pull request as ready for review October 5, 2026 11:21
@vursen
vursen merged commit de7f7ce into main Oct 5, 2026
11 checks passed
@vursen
vursen deleted the docs/grid-byte-array-image branch October 5, 2026 11:33
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