Warning pop up when there is a picture detected in a post

Certainly doable, this kind of functionality though would have to be in a plugin. Especially depending on the implementation.

Something like tesseract is a beast to install, it is a bit of a cross road. You either end up standing up a new API or you pollute your application container. By standing up an API you get better isolation, but then whoever installs this kind of plugin (outside of our hosting) would have to configure and stand up a second container to do this work.

We would need to be very careful with timeouts (what if it takes 10 seconds to figure out its a screenshot of code, what does the user see?)

My off-the-cuff brainstorming here would be something like

  • user post image
  • image shows up in post
  • (concurrently) post is sent to “detect if this is a code screenshot” service
  • when the service eventually responds you show the warning

Blocking all uploads of images on a service (even if local) is risky cause the end user experience can suffer quite a bit.

You could do one “final” delay I guess just before posting to ensure nothing is left in the queue.

This is all potentially feasible work we could take on, but we would need a data set to work with first so we can set expectations (say 50 code snippet images … 50 not code snippet images)

It is a super fuzzy problem, so examples would help ground how well this thing could behave.


An interesting twist would be if this magic service “de-screenshotted” the source code and let the user know … “hey, I can see you tried to post some source code here, would you like me to change it to this block of text”

2 Likes