fix(next/image): use `image-size` pkg as additional format detector (#82538)
In a previous PR https://github.com/vercel/next.js/pull/82118 we added a
fallback to `sharp().metadata()` when the magic number didn't detect the
image format in order to improve detection.
But `sharp` can be slow to read metadata, so we should avoid it if we
can.
So this PR uses the existing `image-size` package to detect the content
type in JS and only then does it fallback to the native `sharp` code if
necessary.
No tests were added since this doesn't change the behavior, only
performance.