• Mose13@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    13 days ago

    So I actually kinda know what I’m talking about, but not really:

    • Lemmy uses pictrs to handle image uploads
      • I know from experience that pictrs will fail on gif upload if max width is greater than PICTRS_MEDIA_ANIMATION_MAX_WIDTH and same for height and (I think) animation frame count
      • It’s less clear to me if static images get auto compressed on upload. Looks like pictrs implemented this a couple years ago, but I’m not sure if this is automatic behavior or has to be turned on by Lemmy admins.
      • I haven’t messed around with limits for image dimensions other than the settings for animated media, but I’m planning on testing this on my instance soon.
    • Lemmy API image upload
      • 0.19.x has all images uploaded via the same API endpoint. So I think any image uploaded should be subject to the same dimension and size limits.
      • In the upcoming Lemmy v1 release, this might change as I believe they will have different upload endpoints for avatar, banner, post, etc. Avatars, for example, might be subject to smaller dimension limits. This is all subject to change as Lemmy v1 is not released yet.
    • Lemmy API getting the image upload limit settings
      • 0.19.x does not expose the image upload limits via the API. So whatever, for example, lemmy.world set’s their limits to, there isn’t an easy way for a Lemmy frontend to look up those limits.
      • In the upcoming Lemmy v1 release, I believe they are planning on adding a way to look up these limits via the API.
    • Other limits
      • Lemmy imposes it’s own rate limits on how many images you can upload/time period. I wanna say the default is roughly 6 images/hour, but I might be totally wrong there.
      • I’m also curious how many sever admins leave the default settings, or change them.

    TL;DR, what does this all mean?

    • Uploading gifs is always going to be a little annoying as they don’t auto compress. As a server admin, I just set the dimension limits higher so users encounter errors on fewer images
    • Non animated images, I’m guessing are automatically compressed on upload. Otherwise I suspect many more people would be complaining about failed uploads. But I’m working on verifying this

    Just to be extra safe – and also here’s why I know all this – I’ve chosen to auto compress images on upload in my own Lemmy/PieFed frontend to 1mb and 1000 max width/height, whichever comes first. I’m actively testing these settings.

    • flamingos-cant (hopepunk arc)@feddit.uk
      link
      fedilink
      English
      arrow-up
      1
      ·
      12 days ago

      It’s less clear to me if static images get auto compressed on upload. Looks like pictrs implemented this a couple years ago, but I’m not sure if this is automatic behavior or has to be turned on by Lemmy admins.

      Non animated images, I’m guessing are automatically compressed on upload. Otherwise I suspect many more people would be complaining about failed uploads. But I’m working on verifying this

      There does seem to be options in pictrs to compress images by format, I’d assume that having these unset (default) would mean no compression happens. I think the reason there isn’t any complaining about image uploads happening is because, by default, they don’t have constraints applied to them. Only animation (256x256 dimension limit) and video (max 20 MiB file size) have constraints put on them in pictrs by default, though there is a 20 MiB upload limit set in nginx.

      Lemmy imposes it’s own rate limits on how many images you can upload/time period. I wanna say the default is roughly 6 images/hour, but I might be totally wrong there.
      I’m also curious how many sever admins leave the default settings, or change them.

      feddit.uk has its set to 2 every 5 minutes. I think a previous admin set that, but it seems sensible enough.

      • Mose13@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        12 days ago

        Thanks! I think I’m just going to upload progressively larger images to my instance and see where uploads fail lol.