file icon indicating copy to clipboard operation
file copied to clipboard

Adding width, height reading functions for images uploads

Open oalkaako opened this issue 5 years ago • 3 comments

oalkaako avatar Jul 15 '20 09:07 oalkaako

i'm in fact very much interested in seeing this PR being done ! i would like to get informations about files (pdf files) : height, width, and page count is this something that can be done inside of the elm/file module or do i have to turn to another, less easy way of getting what i want ? Thanks in advance

AxelPrel avatar Jun 19 '25 14:06 AxelPrel

i'm in fact very much interested in seeing this PR being done ! i would like to get informations about files (pdf files) : height, width, and page count is this something that can be done inside of the elm/file module or do i have to turn to another, less easy way of getting what i want ? Thanks in advance

Images might be possible but pdf functions does not belong in elm/file.
This is due to every page of a pdf can have different size and aspect ratio. (A pdf is a graph of objects, you will need a specific tool that parses the pdf into a graph often involving decrytion and unzipping elements in the tree, you need to select the page you want in that tree and then read the width/height metadata for the specific page. also the pdf specification is old meaning thereis many versions of pdf out there, requiring handling many edge-cases in the parser) What you need is to read bytes from elm/file and then use a pdf parser to extract what you need.

atlewee avatar Jun 19 '25 14:06 atlewee

thank you for your quick response this will definitly help me do what i need

this issue should be closed then right ?

AxelPrel avatar Jun 19 '25 17:06 AxelPrel