zed/crates
Bennet Bo Fenner dd74643993
gpui: Support loading image from filesystem (#6978)
This PR implements support for loading and displaying images from a
local file using gpui's `img` element.

API Changes:
- Changed `SharedUrl` to `SharedUrl::File`, `SharedUrl::Network`

Usage:
```rust
// load from network
img(SharedUrl::network(...)) // previously img(SharedUrl(...)

// load from filesystem
img(SharedUrl::file(...))
```

This will be useful when implementing markdown image support, because we
need to be able to render images from the filesystem (relative/absolute
path), e.g. when implementing markdown preview #5064.

I also added an example `image` to the gpui crate, let me know if this
is useful. Showcase:
<img width="872" alt="image"
src="https://github.com/zed-industries/zed/assets/53836821/b4310a26-db81-44fa-9a7b-61e7d0ad4349">

**Note**: The example is fetching images from [Lorem
Picsum](https://picsum.photos) ([Github
Repo](https://github.com/DMarby/picsum-photos)), which is a free
resource for fetching images in a specific size. Please let me know if
you're okay with using this in the example.
2024-01-29 21:56:51 -08:00
..
activity_indicator Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
ai Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
assets Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
assistant Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
audio Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
auto_update Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
breadcrumbs Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
call Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
channel Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
cli Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
client gpui: Support loading image from filesystem (#6978) 2024-01-29 21:56:51 -08:00
clock Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
collab gpui: Support loading image from filesystem (#6978) 2024-01-29 21:56:51 -08:00
collab_ui gpui: Support loading image from filesystem (#6978) 2024-01-29 21:56:51 -08:00
collections Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
color Licenses: change license fields in Cargo.toml to AGPL-3.0-or-later. (#5535) 2024-01-27 13:51:16 +01:00
command_palette Fix casing of OpenZedUrl action (#7045) 2024-01-29 23:50:31 -05:00
copilot Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
copilot_ui Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
db Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
diagnostics Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
editor Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
feature_flags Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
feedback Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
file_finder Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
fs Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
fsevent fix: isolate macos-specific dependencies (#6854) 2024-01-27 13:38:55 +01:00
fuzzy Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
git Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
go_to_line Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
gpui gpui: Support loading image from filesystem (#6978) 2024-01-29 21:56:51 -08:00
gpui_macros Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
install_cli Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
journal Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
language Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
language_selector Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
language_tools Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
live_kit_client Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
live_kit_server Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
lsp Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
media Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
menu Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
multi_buffer Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
node_runtime Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
notifications Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
outline Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
picker Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
plugin Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
plugin_macros Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
plugin_runtime Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
prettier Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
project Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
project_panel Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
project_symbols Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
quick_action_bar Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
recent_projects Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
refineable Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
rich_text Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
rope Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
rpc Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
search Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
semantic_index Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
settings Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
snippet Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
sqlez Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
sqlez_macros Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
story Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
storybook Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
sum_tree Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
terminal Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
terminal_view Fix terminal line background being reset on each line (#7040) 2024-01-29 21:01:02 -08:00
text Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
theme gpui: Support loading image from filesystem (#6978) 2024-01-29 21:56:51 -08:00
theme_importer Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
theme_selector Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
ui gpui: Support loading image from filesystem (#6978) 2024-01-29 21:56:51 -08:00
util Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
vcs_menu Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
vim Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
welcome Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
workspace Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
zed Fix casing of OpenZedUrl action (#7045) 2024-01-29 23:50:31 -05:00
zed_actions Fix casing of OpenZedUrl action (#7045) 2024-01-29 23:50:31 -05:00