summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
Diffstat (limited to 'src/library')
-rw-r--r--src/library/image.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/library/image.rs b/src/library/image.rs
index cd6a97d1..7fabfe35 100644
--- a/src/library/image.rs
+++ b/src/library/image.rs
@@ -20,12 +20,14 @@ pub fn image(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
let mut node = None;
if let Some(path) = &path {
- if let Some(id) = ctx.cache.image.load(ctx.loader, &path.v) {
- let img = ctx.cache.image.get(id);
- let dimensions = img.buf.dimensions();
- node = Some(ImageNode { id, dimensions, width, height });
- } else {
- ctx.diag(error!(path.span, "failed to load image"));
+ if let Some((resolved, _)) = ctx.resolve(&path.v, path.span) {
+ if let Some(id) = ctx.cache.image.load(ctx.loader, &resolved) {
+ let img = ctx.cache.image.get(id);
+ let dimensions = img.buf.dimensions();
+ node = Some(ImageNode { id, dimensions, width, height });
+ } else {
+ ctx.diag(error!(path.span, "failed to load image"));
+ }
}
}