optionally blur NSFW content in lieu of placeholder image
This MR adds a new configuration setting nsfwUseBlur which uses a client-composited blur of the image or first video frame.
In the case of images, it also adds placeholder text that explains that the content is sensitive. For videos, the play icon is used.
In the event that attachment post-processing is available, such as when running on Mastodon BE or MFC Pleroma, the post-processed image will be used as the basis for the blur composition instead of the raw image or first video frame.
Merge request reports
Activity
252 top: calc(50% - 1em); 253 left: calc(50% - 7em); 254 text-align: center; 255 white-space: nowrap; 256 margin: auto; 257 padding: 5px; 258 background: rgba(230,230,230,0.6); 259 font-weight: bold; 260 z-index: 4; 261 line-height: 1; 262 border-radius: $fallback--tooltipRadius; 263 border-radius: var(--tooltipRadius, $fallback--tooltipRadius); 264 } 265 266 .hider a, .centered-hider a { 267 color: rgba(25,25,25,1.0); 17 17 nsfwImage: this.$store.state.instance.nsfwCensorImage || nsfwImage, 18 18 hideNsfwLocal: this.$store.state.config.hideNsfw, 19 19 preloadImage: this.$store.state.config.preloadImage, 20 nsfwUseBlur: this.$store.state.instance.nsfwUseBlur, 29 {{$t('general.sensitive')}}<br><small>{{$t('general.sensitive_hint')}}</small> 30 </a> 31 </div> 27 32 <img 33 v-if="!nsfwUseBlur" 28 34 :key="nsfwImage" 29 35 class="nsfw" 30 36 :src="nsfwImage" 31 37 :class="{'small': isSmall}" 32 38 > 39 <StillImage 40 v-else-if="type === 'image' || attachment.large_thumb_url" 41 class="nsfw-blur" 42 :referrerpolicy="referrerpolicy" 43 :mimetype="attachment.mimetype" 44 :src="attachment.large_thumb_url || attachment.url" yeah, see https://blurha.sh/. Mastodon computes those and we could just pass them on, and have an option to generate them ourselves.
even if we use blurred versions we should still add a black bar or placeholder image on top of it since people also use nsfw to hide spoilers, while even blurred image or partially obscured non-blurred one could still give away what content is, spoiling the... whatever it's a spoiler for.
if it's a blur hash then you can't really tell any of the content, but seeing colors could ruin some jokes (everyone would recognize the blurred version of tenshi eating a corndog for example) which I don't think is big enough of a reason to block it, maybe a 50% opacity or something could be enough to hide the colors of the blur.
which looks pretty boring, the major upside would be how much slicker it looks. there's also the benefit of being able to differentiate tagged images from reach other using the thumbnail, for example you might see a post with no description get repeated on your timeline, you don't know which post it is or if you've seen it already if all hiders look identical.
that's why i have filenames enabled (says he as he posts images like 14123aefe7668fease76544123.jpg from hydrus)
don't know about slick or boring tho, i'd say custom nsfw images some instances do look less boring but that's just stylistic preference.
would be a good compromise.
ability to manipulate how image is CW'd (i.e. nsfw, very nsfw, spoiler, etc) would be even better
- Edited by HJ
also no one is saying only blur, you can still have some stuff over it, text or even an image or some semi transparent background colored block with text over it. the form of the blur does serve a function, but it'd be silly to hurt the form by blocking most of it (which could still be an admin decision)
Ok, blurhash is more or less good as long as you don't go into high numbers. Questions are:
- are we gonna implement blurhash on clientside?
- if blurhash is serverside how to deal if it's disabled (because i don't want any image processing on server side)
- if we blur using css how to handle if blurring isn't supported by browser or we simply don't care about that?
- if we do blurhash, decoding has to be done client-side
- encoding has to be done serverside, don't think you're gonna be able to avoid any image processing forever without a custom fork
- heavy blur in css sounds expensive, and requires the image to load first while blur hash data is only a handful of bytes that can be sent with the media object. I don't know if I'd support it at all
in any case it requires more experimentation to properly weight the benefits and drawbacks, like if the decoding is expensive then I think some alternative approach is necessary. maybe benchmarking mastodon's use of them would help
i was talking about encoding, blurha.sh seem to do blurhash on clientside pretty well and we already use canvas so we could do that clientside as well instead of css blur
i would really want to avoid forking pleroma-be over minor and trivial thing as lack of "don't do any image processing on server" option
We are already doing some small, optional image processing on the backend with the exif stripping, and soon with thumbnail generation. Having another option for blurhash generation would be possible. Either way, we can expose the existing blurhashes we have from other servers soon so people can start experimenting with frontend looks.
mentioned in issue #979
mentioned in issue pleroma#2294 (closed)








