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

Add image processing and generate blurhash for server thumbnail #19348

Merged
merged 1 commit into from
Oct 13, 2022

Conversation

Gargron
Copy link
Member

@Gargron Gargron commented Oct 12, 2022

The 1200x630px size or even the format has not been enforced before. Turns out you cannot trust server admins not to upload gigantic TIFF images into the server thumbnail setting even if the hint says that the 1200x630px size is recommended. To be honest, there is nothing surprising or even outrageous about it, the surprising part is that 2017-me believed otherwise. Now we will generate web-friendly variants specifically for the thumbnail as well as a blurhash value to handle loading placeholders.

Remove separate server hero setting. Not a lot of sense in keeping the hero and thumbnail as separate settings when I would wager they should be the same in most cases. Reason for keeping thumbnail over hero is that the hero setting has never been exposed in the API. Through the API, the thumbnail appears on the servers list on joinmastodon.org, in the official mobile apps, and possibly other third-party apps, so it has more reach than the hero. Related: #19345

In GET /api/v2/instance, the thumbnail property becomes:

{
  "url": "...",
  "blurhash": "...",
  "versions": {
    "@1x": "...",
    "@2x": "...",
  }
}

@Gargron Gargron added api REST API, Streaming API, Web Push API moderation Administration and moderation tooling labels Oct 12, 2022
@Gargron Gargron force-pushed the feature-site-upload-processing branch from e610b35 to 4705387 Compare October 13, 2022 06:53
@ykzts
Copy link
Sponsor Member

ykzts commented Oct 13, 2022

= image_tag @instance_presenter.hero&.file&.url || @instance_presenter.thumbnail&.file&.url || asset_pack_path('media/images/preview.png'), alt: @instance_presenter.title, class: 'parallax'

I think this line also needs to be fixed (but will not be needed in #19345).

@Gargron
Copy link
Member Author

Gargron commented Oct 13, 2022

I think this line also needs to be fixed (but will not be needed in #19345).

Yes, I figured maybe I can skip it here to avoid merge conflicts.

@Gargron Gargron merged commit b04633a into main Oct 13, 2022
@Gargron Gargron deleted the feature-site-upload-processing branch October 13, 2022 09:29
kadoshita pushed a commit to kadoshita/mastodon that referenced this pull request Nov 19, 2022
nametoolong pushed a commit to nametoolong/nuage that referenced this pull request Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api REST API, Streaming API, Web Push API moderation Administration and moderation tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants