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

Maximum image attachment size is not configurable #2252

Closed
jmahmood opened this Issue Apr 21, 2017 · 10 comments

Comments

Projects
None yet
8 participants
@jmahmood
Copy link

jmahmood commented Apr 21, 2017

Hi,

I noticed that the image size used for the media API is not configurable.

This is set in ./models/media_attachment.rb, specifically here:

IMAGE_STYLES = { original: '1280x1280>', small: '400x400>' }.freeze

I am making a screenshot generator bot for my own mastodon instance and I often get much larger image files than 1280 x 1280. Moreover, the term "original" for a resized file is a bit confusing.

I understand there are several work arounds I could do; increase the size in the source code, or upload directly to a separate location.

Is this for a specific reason ("We do not want you using the API to store the original files on the Mastodon server") or is it something that may be changed in the future to allow us to configure the file more effectively?


  • I searched or browsed the repo’s other issues to ensure this is not a duplicate.
@expenses

This comment has been minimized.

Copy link
Contributor

expenses commented Apr 21, 2017

couldn't you just change those settings?

@jmahmood

This comment has been minimized.

Copy link

jmahmood commented Apr 21, 2017

As mentioned, I made changes directly in the Ruby file, which is OK for me, but shouldn't these sorts of items be exposed in the administration menu?

Moreover, 1280 x 1280 is ~1.6 megapixels; it's tiny in a world where even bad phones have 8 megapixel cameras.

Finally, the image being modified when it is marked in the API as the "Original" file is not the behavior that I would expect.

I am willing to believe it is a good reason, but I couldn't find it while going through the git history. Maybe the JavaScript is primed for a certain file size which is why we need to keep it @ that size, or maybe the true original file should be placed directly into a directory that is exposed by Nginx so as to skip the ruby application server entirely. (I think that is already happening, but it's all I could think of)

@ashfurrow

This comment has been minimized.

Copy link
Collaborator

ashfurrow commented Apr 23, 2017

I took a look at this and the original file isn't being saved to S3 as I'd expect to. I imagine the original reason was to save on storage space, but there's also a cap on file sizes so I'm not sure it's prudent to discard the original.

We could keep the original, replace original with something like large, and then create a link from the media modal to the original. Does that make sense? I can start working on it if that's the direction we'd like to move in.

I think with that solution we wouldn't even need the configurable option, since we'd keep the original. Thoughts?

@Gargron

This comment has been minimized.

Copy link
Member

Gargron commented Apr 24, 2017

The settings are not configurable because we want to ensure that in most cases attachments on one instance can show up fine on another. If one instance allows 20MB uploads while another only 1MB, the experience will be broken. Current setting is a sensible default that works for most cases, and when you need more, I suggest using external hosting (YouTube, Flickr, etc - specialized hosting)

@ashfurrow

This comment has been minimized.

Copy link
Collaborator

ashfurrow commented Apr 24, 2017

Gotcha, thanks for following up @Gargron.

@jmahmood it sounds like this is intended behaviour that's not going to be changed. Thanks for opening the issue – I'm sure the answer will be helpful to others. Going to close this issue; if things aren't answered to your satisfaction, please feel free to re-open. Thanks!

@sftblw

This comment has been minimized.

Copy link

sftblw commented Apr 8, 2018

I think 1280 x 1280 is too small for 8mb limitation... Could it be enlarged to 4096 x 4096 and still limit file size by 8mb as same as usual?

@ghost

This comment has been minimized.

Copy link

ghost commented Apr 21, 2018

@Gargron I agree with your explanation that people can upload it to external sources, but than it would be desirable to implement the following feature request for jpg+png images as well:

#7031

@glubsy

This comment has been minimized.

Copy link

glubsy commented Aug 18, 2018

The settings are not configurable because we want to ensure that in most cases attachments on one instance can show up fine on another

@Gargron then why not allow access from other instances to the resized file, but when the user really needs the original file size, let him access that file somehow, either by tweaking the URL to point to the original file (if stored on its instances) or even better (but that would requite some work) place a button that points to that original file's URL.

Some users are way too lazy to look for a third party host and copy paste the link to the original file manually for each post, sadly. So having access to the original file is really important, even if only on its original instance.

I'd rather not use Mastodon at all if I know the original files are lost when I directly upload them to an instance.

@PandorasFox

This comment has been minimized.

Copy link

PandorasFox commented Aug 31, 2018

The settings are not configurable because we want to ensure that in most cases attachments on one instance can show up fine on another. If one instance allows 20MB uploads while another only 1MB, the experience will be broken. Current setting is a sensible default that works for most cases, and when you need more, I suggest using external hosting (YouTube, Flickr, etc - specialized hosting)

Wouldn't the ideal situation then be to standardize upon some dimensions/sizes for federation, but allow instances to do whatever with the 'original' file size limit? ie photography or art focused instances would definitely want originals intact.

I understand the need for having some standards for media for sane federation, but I don't really see why this can't be improved.

@glubsy

This comment has been minimized.

Copy link

glubsy commented Aug 31, 2018

but allow instances to do whatever with the 'original' file size limit? ie photography or art focused instances would definitely want originals intact.

Absolutely right.

Pleroma doesn't limit file sizes like Mastodon does, but since both Mastodon and Pleroma instances can be accessed via the Fediverse, the original files will only be retained by Pleroma instances.

I have looked around the Mastodon source code and couldn't clearly determine how to enforce original file retention (and delivery) on Mastodon, but I have a feeling it's possible somehow...

As it stands right now, I'd rather set up a Pleroma instance instead of a Mastodon instance for that very reason.

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