Subtle changes, bugs and feedback

Posted on
Page
of 312
  • This site does nothing special, this sounds like a browser issue. Are you an iPhone user?

  • Yeah iPhone chrome. I’ll check on safari later but last time it kept opening with the page number selected, bringing up the number pad.
    It’s not the end of the world, just wondered if there was anything obvious I was missing! Think I just notice more now I’ve quit social media and using the forum more

  • I suspected iPhone because all browsers on an iPhone are just Safari with different skins, and Safari is by far the worst browser that is out there.

    You can try another browser on the device, but I suspect it will be just the same outcome.

  • Page number box selected was I think due to a saved password/over-eager autocomplete; @Dammit and whoever else eventually got to the bottom of it.

  • @hangedup

    Yeah - it was a hangover from when the forum had username/password logins

    Check if your password manager has any login details saved for lfgss. Delete them if so since lfgss used auth0 now

    The jumping to the number box thing should go away then

  • Is there an issue posting links to Instagram reels or am I being a bit dense?

    Tried to post this link a few times and if you click the link whilst in preview, it works fine. But once you actually post the reply and click the link again Instagram says 'this reel is unavailable'.

    https://www.instagram.com/reel/C-XHkcngwEy/

  • oh interesting... the link is case-sensitive and something converts the actual link to lowercase.

  • Do you happen to store the width and height of attached images?

    If you whack the width/height attributes on the <img> tag and then override their values with css !important the browser does some additional calculations to stop this happening.

    Wouldn't help with embedded images from other sites, but could be worth a shot?

    (Edit: Would be happy to send a pull request if the data's accessible and getting a local system up is easy enough)

    Edit 2: hmm, doesn't seem like it's in the model, so ignore me:
    https://github.com/buro9/microcosm/blob/e4868670a74a80ccd0eb79dbefadd4d574baa905/models/attachment.go#L6

  • ha, well there you go! I kept copy/pasting and posting and just couldn't figure out why it wouldn't work. At least it's not me being totally inept this time.

  • nope, I don't store the dimensions.

    I agree that doing so would make everything better... but it won't work for the vast majority of images which are third party and just inlined.

  • nope, I don't store the dimensions.

    I guess without additional server-side processing specifically for image types you'd have to use information from the browser, so it's not exactly trustworthy either. Oh well, worth asking 🙂

  • in real-time it also gives us nothing... we don't have the image dimensions until after the image has loaded.

    in theory I could then store them, but if they images are modified on the remote source I'd not know and then it would be wrong again.

    the current behaviour is the least worst, and the oldest style of inlining images on the internet... so the browsers should do a good job with it, it's the most ubiquitous approach on the internet.

    but I'm constantly surprised by minor incompatibilities and issues 🤷

  • Oh yeah, dealing with third-party image dimensions is just not worth the bother. I was just talking about first-party images really, but there are still barriers there too with additional processing cost and whatnot.

    Was the microcosm api source ever public by the way? I was just browsing through the microweb code to see if there was any image processing, which would be on the API side anyway, and couldn't quite remember if it was or not

  • always been open source, but just moved it recently.

    I do process files on upload, as many cameras screwed up the orientation of images and so I needed to read EXIF and perform rotations to correct orientation.

    https://git.dee.kitchen/buro9/microcosm/src/branch/main/models/file.go#L554-L616

    So I do have the dimensions at that point in time.

    However... it's not as good as you might imagine.

    I've been processing dimensions since day 1, but only 51% of images have a dimension attached with them, and there are 6,085 distinct values for width, and 5,252 distinct values for height.

    It's a total mess... some dimensions couldn't be extracted, and the variety is huge, and this barely has 50% coverage of the attachments that are known image mimetypes.

    It turns out images uploaded to the internet are mostly garbage.

    Finally... doing the CSS you suggest would break more than you imagine, today images are "maximum size within the flexible layout", they aren't the true image size... true image size for files that are 30MB might be huge and totally blow up the layout as it would expand the layout to fit, or it would overflow and result in scrolling.

    This approach seems to be a bad one.

    A better one is probably to generate thumbnails for every image at known dimensions, and embed those at a maximum size and allow downscaling. I originally did try this, but the image processing... Go wasn't good at everything thrown at it, so many garbage images, and I refused to add complexity, cost, and to reduce security by adding ImageMagick to process these things.

    I could've used a third party for thumbnail generation, but then I have additional egress charges as well as a third party charge, and we have a non-trivial trivial number of images, over 1M on LFGSS alone... so the cost would also be very high.

    All of this was thought about, but least worst won out.

  • At least it's not me being totally inept this time.

    No, this is me.

    Or at least https://git.dee.kitchen/buro9/microcosm/src/branch/main/models/link_process.go#L224

    It's this: https://github.com/mccutchen/urlresolver

    Which calls this: https://github.com/PuerkitoBio/purell

    Somewhere in there... something is causing two bugs:

    1. the path / folder parts of links are being lower cased when they should not be.
    2. the # fragment is being removed when it should not be.

    will investigate later.

  • Thanks for the link, will have a browse!

    Yeah EXIF data isn't reliable, I totally agree. I'm surprised that the Go image package's image.DecodeConfig doesn't mostly return the correct dimensions though, at least with the standard formats. It seems like it parses it from the image data itself, so a 49% failure rate is bonkers.

    Finally... doing the CSS you suggest would break more than you imagine, today images are "maximum size within the flexible layout", they aren't the true image size... true image size for files that are 30MB might be huge and totally blow up the layout as it would expand the layout to fit, or it would overflow and result in scrolling.

    That's actually not the case anymore, if it's what I'm suggesting. Say there's this:

    <style>
     .attachment-image { max-width:100% !important;  height:auto !important; }
    </style>
    ...
    <img class="attachment-image" src="blah.jpg" width="3000" height="2000" />
    

    Browsers will quietly add the aspect-ratio property to the image's base computed styles as:

    aspect-ratio: auto 3000 / 2000;
    

    So it'll default to its normal size when smaller than the container, but resizes flexibly using the max width when it's larger. You can add the aspect-ratio property explicitly on the image's style attribute if you really want, but it's not necessary. That wasn't the case a few years ago, when image dimensions were best left off to allow the flexible behaviour. (Nowadays, the browser having those dimensions at load time means it can do a bit of optimisation up front, and stop the page jumping as images load in).

    In any case, that's all theoretical if there aren't dimensions to use in the first place, and I've used up enough of your time 🙂

  • It seems like it parses it from the image data itself, so a 49% failure rate is bonkers

    Yeah, I'm unsure why that would be, I keep Go and all of the dependencies up to date and so I expect that this would just work.

    I started recording dimensions on day one, as most of what you describe is what I wanted to do. I just never had quality in the data to do it.

    I wonder if there's an Nginx plugin for image resizing and reporting dimensions... because I could always come up with something convulated that used that, i.e. created thumbnails via an inline request to a reverse proxy, and then reported out the new dimensions, and saved those back to the database for subsequent views.

  • That does indeed sound complicated and not worth the effort!

    If you can share a couple of examples of image attachments that couldn't have their dimensions parsed, I can run some tests to see if there's anything else going on if you'd like?

  • Oh God... it's worse than I thought... no wonder it didn't work.

    • image/tiff
    • image/svg+xml
    • image/x-ms-bmp
    • image/x-portable-pixmap
    • image/x-nikon-nef
    • image/x-matroska

    That last one sounds like it's a video not an image... most are unsupported by anything, and some are custom.

    This is 15 out of the last 50 attachments... but there are some PDFs and other things in there and it doesn't mean a third of images based on the most recent sample.

    It just means it's not garbage per se... it's just unsupported by a library that focuses on a tiny number of most common image types.

  • I've also just found an image within an RFC822 "encapsulated mimetype".

    I'm in a meeting, but am tempted to go find out what the hell that is about.

  • image/tiff
    image/svg+xml
    image/x-ms-bmp
    image/x-portable-pixmap
    image/x-nikon-nef
    image/x-matroska

    Yeah that'll do it! 😂

  • I have a sub-forum on ignore but it still shows up on the front page.
    If the last post in a forum is in the ignored sub-forum, that post shows up on the right on the front page.

    This one is fun.

    I think it's this query...
    https://git.dee.kitchen/buro9/microcosm/src/branch/main/models/microcosms.go#L1148-L1157

    SELECT microcosm_id
          ,title
          ,logo_url
      FROM microcosms m
     WHERE parent_id = $1
       AND is_deleted IS NOT TRUE
       AND is_moderated IS NOT TRUE
       AND (get_effective_permissions(site_id,microcosm_id,2,microcosm_id,$2)).can_read IS TRUE
     ORDER BY is_sticky DESC, comment_count DESC, title ASC
    

    And I think this is the solution:

    SELECT microcosm_id
          ,title
          ,logo_url
          ,i.profile_id
      FROM microcosms m
           LEFT JOIN ignores_expanded i ON i.profile_id = 79578
                                       AND i.item_type_id = 2
                                       AND i.item_id = m.microcosm_id
     WHERE parent_id = 807
       AND is_deleted IS NOT TRUE
       AND is_moderated IS NOT TRUE
       AND i.profile_id IS NULL
       AND (get_effective_permissions(site_id,microcosm_id,2,microcosm_id,79578)).can_read IS TRUE
     ORDER BY is_sticky DESC, comment_count DESC, title ASC;
    

    For your set of ignores, this would literally only show the Current Projects forum on the home page, nothing else... and effectively all other threads in all forums become unnavigable.

    I might deploy the fix and see what I blow up.

  • @Tijmen does it work?

    Also... how did you ignore forums? There's no button for that. Is that on the mobile app?

  • Fixed the Insta links, this should now work https://www.instagram.com/reel/C-XHkcngwEy/

  • works for me

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Subtle changes, bugs and feedback

Posted by Avatar for Velocio @Velocio

Actions