image support #6

Closed
opened 2 years ago by dawidkubis · 2 comments
Owner

Strongly tied to #2, since image support requires it.
Reading images means that we would need to process content-type and content-length. BufReader has a default capacity of 8KB, which will would need to expand if we wish to have normal-sized images.
Another thing is that, at the moment, I am unaware of any ways to figure out where the image ends apart from trusting content-type.
Maybe a different BufReader could be made for images specifically, but that would require some hacking.
Also probably needs the http::Request to become a trait.

Strongly tied to #2, since image support requires it. Reading images means that we would need to process `content-type` and `content-length`. `BufReader` has a default capacity of 8KB, which will would need to expand if we wish to have normal-sized images. Another thing is that, at the moment, I am unaware of any ways to figure out where the image ends apart from trusting `content-type`. Maybe a different `BufReader` could be made for images specifically, but that would require some hacking. Also probably needs the `http::Request` to become a trait.
Poster
Owner

1651126606 adds support for binary responses, so we can now serve images, like with favicon.ico.
I'm not sure how to serve post images yet, I'm thinking /<post_id>/img should be good enough.

1651126606 adds support for binary responses, so we can now serve images, like with `favicon.ico`. I'm not sure how to serve post images yet, I'm thinking `/<post_id>/img` should be good enough.
dawidkubis added the
enhancement
label 2 years ago
Poster
Owner

Technically works as of 06d2d7a957, just needs #1 to actually look good.
There are a few problems, namely

  • the filename and metadata are ignored (this I can live with)
  • the image is served as <id>/img, which makes the browser save it as img.<ext> which is problematic because I would much prefer <id>.<ext>
  • there is no way to extract images from the database (this I can also live with)

In any case, the last problem can be solved by making an utility for it (presumably in bin/), which should be easy enough.

Technically works as of 06d2d7a957, just needs #1 to actually look good. There are a few problems, namely + the filename and metadata are ignored (this I can live with) + the image is served as `<id>/img`, which makes the browser save it as `img.<ext>` which is problematic because I would much prefer `<id>.<ext>` + there is no way to extract images from the database (this I can also live with) In any case, the last problem can be solved by making an utility for it (presumably in `bin/`), which should be easy enough.
dawidkubis closed this issue 2 years ago
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: dawidkubis/kchan#6
Loading…
There is no content yet.