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 http://mymediacrush.net, 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).
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 https://mediacru.sh 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="https://mediacru.sh/' + ↩ window.filename + '/frame" frameborder="0" allowFullscreen width="' + ↩ size.width + '" height="' + size.height + '"></iframe>'
to
embed.value = '<iframe src="http://mymediacrush.net/' + ↩ window.filename + '/frame" frameborder="0" allowFullscreen width="' + ↩ size.width + '" height="' + size.height + '"></iframe>'
You also probably will have to hunt down more instances of "https://mediacru.sh" 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).
Apps
Two browser extensions are available – one for Firefox and one for Chrome – that allow you to upload media to mediacru.sh; 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 https://mediacru.sh/
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
server="https://mymediacru.sh"
to
server="http://mymediacrush.net"
(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.
Conclusion
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.
Infos
- MediaCrush: https://mediacru.sh
- "MediaGoblin Media Sharing" by Paul C. Brown, Linux Magazine, issue 157, 2013, pg. 84, http://www.linux-magazine.com/Online/Features/MediaGoblin/%28language%29/eng-US
- Imgur: http://imgur.com/
- RES: http://redditenhancementsuite.com/
- MediaCrush extensions and more: https://github.com/MediaCrush
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
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.
News
-
So Long Neofetch and Thanks for the Info
Today is a day that every Linux user who enjoys bragging about their system(s) will mourn, as Neofetch has come to an end.
-
Ubuntu 24.04 Comes with a “Flaw"
If you're thinking you might want to upgrade from your current Ubuntu release to the latest, there's something you might want to consider before doing so.
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.