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

Blurhash isn't being generated for local images in Astro #780

Open
carlos-dubon opened this issue Feb 22, 2025 · 0 comments
Open

Blurhash isn't being generated for local images in Astro #780

carlos-dubon opened this issue Feb 22, 2025 · 0 comments

Comments

@carlos-dubon
Copy link

Describe the bug
Blurhash isn't being generated for local images in Astro.

To Reproduce

---
import { Image } from "@unpic/astro";
import localImage from "@assets/img/my-local-image.jpeg";

This works and generates a blurhash
<Image
      src=''https://images.unsplash.com/photo-1496128858413-b36217c2ce36?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=256&h=256&q=80"
      alt="Remote image"
      width={256}
      height={256}
      placeholder="blurhash"
 />

This doesn't generate a blur has:
<Image
      src={localImage}
      alt="Local image"
      width={256}
      height={256}
      placeholder="blurhash"
 />
---

This is my astro config:

// @ts-check
import { defineConfig } from "astro/config";
import tailwindcss from "@tailwindcss/vite";
import { imageService } from "@unpic/astro/service";
import react from "@astrojs/react";

import mdx from "@astrojs/mdx";

// https://astro.build/config
export default defineConfig({
  vite: {
    plugins: [tailwindcss()],
  },
  image: {
    service: imageService({
      placeholder: "blurhash",
    }),
  },
  integrations: [
    react({
      experimentalReactChildren: true,
    }),
    mdx(),
  ],
  experimental: {
    svg: true,
  },
});

Screenshots

Remote image:

Image

Local image

Image

Desktop (please complete the following information):

  • OS: Windows
  • Browser Edge (Chromium based)
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

No branches or pull requests

1 participant