nuxt / image

Plug-and-play image optimization for Nuxt applications.
https://image.nuxt.com
MIT License
1.32k stars 268 forks source link

Get the image size on the server for layout optimizations and calculations #457

Open SimonBackx opened 2 years ago

SimonBackx commented 2 years ago

In order to do some necessary image placement calculations, we need to get the image size on the server in nuxt/content articles. But I could not find any way to do this. The $img.getMeta method isn't reliable and doesn't seem to work (returning width: 0, height: 0). It is essential that we have the dimensions on the server already, and we don't need to have it on the client side.

This seems such a basic thing to do, but I have searched for hours and could not find any solution.

luksak commented 2 years ago

@SimonBackx Here is a quite similar issue: #332

But I guess that you are looking for a solution at runtime, not when SSGing, right?