#Get image information

5 messages · Page 1 of 1 (latest)

brave yew
#

Hey hey :) currently i load an image via image()
Is it somehow possible to get information about the image? Like detected "format"?
And the loaded bytes?

thin sandal
#

The detected format is completely transparent, sadly no way to get that at the moment.

What you can get back out is what you provide (source, alt-text, etc.); from there you could for example look at the file-extension.
You can't get the loaded bytes, but you can read the source separately and inspect them that way.

Note that image() also accepts the bytes type as a source. You'd need to handle that separately, but in that case, you can indeed get the bytes back out directly.

brave yew
#

Ah okay, so i need to build my own "mime" detection method

thin sandal
#

if you have experience with other languages you could probably package an existing library as a plugin, but yes I don't think something like that exists yet.