Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML export to use cropped, centered images #101

Open
kensanata opened this issue Apr 24, 2023 · 4 comments
Open

HTML export to use cropped, centered images #101

kensanata opened this issue Apr 24, 2023 · 4 comments

Comments

@kensanata
Copy link
Owner

As discussed here: #100

@lightnin
Copy link

lightnin commented May 2, 2023

Is this also where we should describe the need to handle the various configs of 1,2, and 3 images in a way that's similar to how Mastodon handles multi-image toots? Here's how mine stand currently.
Screenshot 2023-05-02 at 08 15 08

@kensanata
Copy link
Owner Author

Yeah. I want something like this:

 +-------------------------+
 |                         |
 |                         |
 |                         |
 |                         |
 |                         |
 +-------------------------+
 +------------+------------+
 |            |            |
 |            |            |
 |            |            |
 |            |            |
 |            |            |
 +------------+------------+
 +------------+------------+ +--------+--------+--------+
 |            |            | |        |        |        |
 |            |            | |        |        |        |
 |            +------------+ |        |        |        |
 |            |            | |        |        |        |
 |            |            | |        |        |        |
 +------------+------------+ +--------+--------+--------+
 +------------+------------+
 |            |            |
 |            |            |
 +------------+------------+
 |            |            |
 |            |            |
 +------------+------------+
 +------------+------------+
 |            |            |
 |            |            |
 +------------+------------+
 |            |            |
 |            |            |
 +------------+------------+
 |            |            |
 |            |            |
 +------------+------------+

Not sure about how to layout 5. :)

@lightnin
Copy link

lightnin commented May 2, 2023

That looks great to me.
Seems like it should be possible to find and copy whatever code does this in the mastodon source? I've never sniffed around and won't have time to now (still got a few chapters to write)... but theoretically it's there.....

@kensanata
Copy link
Owner Author

I think the core code change is in html.py. Currently we only differentiate between "one" media attachment and "more". The code passes "one" or "more" to the media_template which uses it as a CSS class. Everything else, ideally, would happen in CSS.

        media = media_template % (
                'more' if len(attachments) > 1 else 'one',
                ''.join(previews))

I think the solution would be to change the code to use classes "one", "two", "three", "four" and "more", and then just write more CSS.

Currently, there's this:

.more a {
        max-width: 50%%;
        max-height: 50%%;
        display: block;
}

If you have one, height and width should be 100%. If you have two, height should be 100%. If you have three, the first one should have height 100%. And so on. At least that's my naive approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants