Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhanced:img returns NaN height when image is imported within script block #12727

Open
jasongitmail opened this issue Sep 27, 2024 · 0 comments

Comments

@jasongitmail
Copy link

Describe the bug

This HTML was generated by enhanced:img with the same source image, but loaded two different ways:

enhanced

Notice one has a valid height and the second is NaN.

Reproduction

The first (green box) containing the valid height was generated using:

<enhanced:img src="$lib/assets/images/example.png?w=280;560" alt="" width="280"/>

The second (red box) was generated using:

<script lang="ts">
  import example from "$lib/assets/images/example.png?enhanced&w=280;560"
</script>

<enhanced:img src={example} alt="" width="280" />

I assume this is unexpected b/c the property would at least be omitted but never added as NaN.

Logs

No response

System Info

System:
    OS: macOS 14.5
  npmPackages:
    @sveltejs/adapter-cloudflare: ^4.7.2 => 4.7.2 
    @sveltejs/enhanced-img: ^0.3.8 => 0.3.8 
    @sveltejs/kit: ^2.5.28 => 2.5.28 
    @sveltejs/vite-plugin-svelte: ^4.0.0-next.7 => 4.0.0-next.7 
    svelte: ^5.0.0-next.257 => 5.0.0-next.257 
    vite: ^5.4.8 => 5.4.8

Severity

annoyance

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants