Anonymous media sharing with MediaCrush

Going Public

The above configuration will be okay for a test run, but it won't do you any good for production. First, the use of port 5000 is no good if you want users to visit your site regularly. It's too weird. Second, the links and snippets MediaCrush generates for each image, video, or audio file for your sharing pleasure won't work because they'll redirect to the wrong address.

The developers of MediaCrush recommend using Nginx as a reverse proxy for your site if you intend to open it up to the Internet. (It's also good for an internal network – remember to include a new line in your /etc/hosts files.)

# apt-get install nginx

Listing 2 shows a minimal Nginx proxy setup. To use it, type the contents into a text file called mediacrush, and drop it into /etc/nginx/sites-enabled (remember to move the default file out from /etc/nginx/sites-enabled and put it elsewhere). Now, restart Nginx.

Listing 2

Minimal Nginx Configuration


The client_max_body_size 25M line limits uploads to 25MB or less. If you're not afraid your hard disk will be stuffed with kitty pictures, you can change that size.

Now you can run MediaCrush with gunicorn:

$ gunicorn -w 4 app:app

then visit, and – Hey presto! – you should have a perfectly working MediaCrush setup.

Your site will allow you to upload files by dragging and dropping them onto the box on the main page. If you drag more than one file, you can create an album, grouping them together. If you click on any of your pictures or videos, MediaCrush opens it in a separate window or tab within your browser and allows you to choose an action from the Embed, Share, Download, Reported, or Delete choices offered below the image (Figure 4).

Figure 4: You can download, embed, or share your media by clicking on any of your pics.

If you choose Embed, MediaCrush supplies you with an HTML snippet you can include in your website or blog (see "A Note on Embedding"). Sharing gives you a link within your MediaCrush site – a direct link to your image or video – as well as Markdown, HTML, and BBCode snippets.

A Note on Embedding

You need to make sure your instance of MediaCrush shows the correct HTML snippet that points to your own site, and not the original site. To do this, you have to change the </route/to/your/>mediacrush/mediacrush/static/view.js file (those consecutive mediacrush directories are not a mistake). Change the line that says

embed.value = '<iframe src="' + ↩
  window.filename + '/frame" frameborder="0" allowFullscreen width="' + ↩
  size.width + '" height="' + size.height + '"></iframe>'


embed.value = '<iframe src="' + ↩
  window.filename + '/frame" frameborder="0" allowFullscreen width="' + ↩
  size.width + '" height="' + size.height + '"></iframe>'

You also probably will have to hunt down more instances of "" hard-coded into files if you want to personalize your site completely. Places to look are in files stored in the templates/ and docs/ folders.

MediaCrush creates a mobile version of your site automatically. Point your smartphone to your site, and you'll see a simplified version with big buttons for fingers (Figure 5).

Figure 5: MediaCrush automatically creates a mobile-friendly site.


Two browser extensions are available – one for Firefox and one for Chrome – that allow you to upload media to; however, with a little tweaking, they can be made to upload to your site instead. The source for both extensions [5] are written in clear JavaScript, and you would only need to change all the instances of within the code to the URL of your own site.

The same goes for the command-line app, MediaCrush-cli. You'll need to change the line that says




(if you have been following naming in the examples to the letter). A word of caution with regard to the -r recursive option for this app: It does not work as expected. Also, if you have a symbolic link within your directory, you could find yourself uploading more than you expected.

Instead of using recursion – always a gamble – use:

$ MediaCrush-cli -a somedirectory/*

This will upload all the media into somedirectory and spit out an album link at the end containing all your pics.


MediaCrush not only looks good, it works great. Uploading is easy and fast. The compression functionality boosts the speed at which the media is shown, and visitors will appreciate how simple and straightforward it is to use. MediaCrush is an excellent way to share or embed media on the web.


  1. MediaCrush:
  2. "MediaGoblin Media Sharing" by Paul C. Brown, Linux Magazine, issue 157, 2013, pg. 84,
  3. Imgur:
  4. RES:
  5. MediaCrush extensions and more:

The Author

Paul C. Brown is an author and editor who has written extensively about Usenet, Internet technologies, trends and fads, and free software and culture since 1996. Before that he was an English teacher.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.