Filtering for vulgar images is one of the hardest things to do and gets into some very complicated image analysis requirements. The issue here is that what constitutes a vulgar image is very subjective and hard (though not impossible) to detect and filter out.
There are a wide range of methods used online and I will cover a few of the more common methods here...
- Report Link On Each Image
In this situation you are working on the assumption that the vast majority of images being loaded comply with the requirement against vulgarity. Basically below every single image (perhaps right next to the caption) is a report link that when clicked will flag the image for manual moderator intervention. The problem here is that it does allow the images on to begin with and basically says trust all images unless otherwise reported, and still needs moderator intervention if a report is made.
- Block Images Except From Trusted Users
In this situation you are saying that the vast majority of users are not to be trusted straight away and instead need to build up some sort of reputation in the community before they are allowed to post images (think something similar to the SE reputation model).
- Run Pre or Post Publishing Machine Scan on Every Image
This is where it starts to get more complicated and costs start to get involved. Basically what you are doing is either before the image is published to the wiki or after it has been published you are sending the image to an online image screening service (such as Google Cloud Vision API or WebPurify Image Moderation). These services then analyse the image and return the analysis on the likelihood of the image containing vulgar elements or not. They can return false positives as image analysis is not perfect, the same as any other machine learning it does make mistakes, and there are costs involved that can get high if there are a lot of images needing to be scanned daily but by and large this would be the only option to protect against vulgar images. I have done a WebPurify integration in the past for a imageboard that decided to scan every image they received, and while it did a great job blocking all vulgar images it did still result in a high cost, though they where scanning thousands of images a month which is an unlikely load for a wiki unless it is an extremely large and board wiki (like wikipedia itself).
You will find yourself encountering other issues as well potentially more from the legal side of things as some jurisdictions have laws and regulations dealing with illicit content online, and many hosting providers also have similar rules in their terms of service and these may outline the minimum obligation of websites on how to protect against such vulgar media beyond the list I have provided and so you would need to check within your own jurisdiction and with your hosting provider to see if they have any additional requirements.
As a side note basically each method I have listed above can work whether the images are uploaded to your server or are loaded to another server and linked to. The advantage to using another server and linking to it (like Imgur) is that the bandwidth for delivering the images to the browser is not incurred by your website so it helps reduce bandwidth, increases site load times as the image can be downloaded from the other domain in parallel to the content from your own server (most browsers only support two simultaneous downloads from a single server at a single time) and it also helps reduce the disk usage on your server as you are not needing to store a large number of images on your server. Irrespective of if you host the images yourself or have them on a third party upload service that the users link to the image moderations services online can generally work with them. Some require just a link to the image itself which can be provided through either method, others require the file itself to be uploaded in which case you would need to have a back end worker script that gets run each time an image is loaded that sends a copy of the image to the moderation service, and others (like Google) just need the base64 version of the image which you can get just by converting the image while on your server to base64 or by downloading the image from the remote hosting service onto your server's temp folder and getting the base64 before deleting it again.