Various performance improvements

- Call to the php `getimagesize` require a disk access, which might not be fast at all, the first commit cache its result.
- Computing the thumbnail dimension at each request is not needed, the third commit allow to compute the `salts` hash without computing the resulting thumbnail dimension.

In case of remotely stored assets, this allow us to serve the thumbnail URL without accessing the original image at all. If the images are stored on S3 for instance, this is pretty much required.