RafidMuhymin / astro-imagetools

Image Optimization tools for the Astro JS framework
astro-imagetools-docs.vercel.app
MIT License
401 stars 45 forks source link

Pitcture's image src attribute should have a file extension #102

Open aminya opened 2 years ago

aminya commented 2 years ago

The src attribute in the img tag generated by the Picture component doesn't have a file extension. This is incorrect.

<img src="./assets/test@200w.ac742458" srcset="./assets/test@200w.ac742458.jpeg" >

The astro code is:

<Picture src="/src/images/test.png"
          alt="" 
          format={["avif", "webp" , "jpeg" ]} 
          fallbackFormat="jpeg" 
          includeSourceFormat={false} 
          formatOptions={{ jpg: { quality: 100}, webp: { quality: 100, }, avif: { quality: 90 }}} 
          width={200} />

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-src

philschonholzer commented 2 years ago

I have the same problem with images in MD files: https://github.com/ApptivaAG/gaston-webpage/blob/4ee4cfeee1a1ad1b879ff96ad36d06fb48d8e5eb/src/pages/en/blog/update-2022-q1/index.md?plain=1#L21 (Markdown) -> https://gastonsolution.com/en/blog/update-2022-q1/ (rendered)

laurieherault commented 1 year ago

Same problem here. This is problematic because some tools like Ahrefs will consider these links as broken links.

<img src="/assets/cns@200w.cedfd24" srcset="/assets/cns@200w.cedfd245.png" ...>