Files
zed/crates
Jason Lee 1982a5aed1 gpui: Improve img element to support load from Assets (#15482)
Release Notes:

- N/A


Currently, the `img` element provided by GPUI only supports FilePath or
URL, but in actual applications we need to let `img` load an image
embedded in Assets.

The `svg` element can currently support this, but `img` cannot.

For example:

We have such an Assets directory:

```
assets
|- icons
|- images
|--- foo.png
```

```rs
// If give a path, considered an Asset
img("images/foo.png");
// If give a URI, considered a Remote image
img("https://foo.bar/images/foo.png");
// If give a PathBuf, considered a Local file
img(PathBuf::from("path/to/foo.png"));
```


## Example test

```
cargo run -p gpui --example image 
```

<img width="827" alt="image"
src="https://github.com/user-attachments/assets/e45dcf7f-4626-4fb0-aca9-9b6e1045a952">

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-07-30 10:55:48 -04:00
..
2024-05-29 18:06:45 -07:00
2024-07-23 15:01:05 -07:00
2024-07-26 16:42:21 -07:00
2024-07-23 15:01:05 -07:00
2024-04-30 23:31:59 -06:00
2024-07-23 15:01:05 -07:00
2024-07-28 11:07:10 +02:00
2024-03-11 10:45:57 +01:00
2024-07-15 17:04:15 -06:00
2024-07-28 11:07:10 +02:00
2024-07-25 09:00:53 -06:00
2024-07-26 17:40:38 -04:00
2024-07-26 16:42:21 -07:00
2024-06-21 16:32:32 -07:00
2024-07-26 03:31:41 -04:00
2024-04-15 14:21:52 +02:00
2024-07-29 09:22:25 -06:00