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
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.
-
ZorinOS 17.1 Released, Includes Improved Windows App Support
If you need or desire to run Windows applications on Linux, there's one distribution intent on making that easier for you and its new release further improves that feature.
-
Linux Market Share Surpasses 4% for the First Time
Look out Windows and macOS, Linux is on the rise and has even topped ChromeOS to become the fourth most widely used OS around the globe.
-
KDE’s Plasma 6 Officially Available
KDE’s Plasma 6.0 "Megarelease" has happened, and it's brimming with new features, polish, and performance.
-
Latest Version of Tails Unleashed
Tails 6.0 is based on Debian 12 and includes GNOME 43.
-
KDE Announces New Slimbook V with Plenty of Power and KDE’s Plasma 6
If you're a fan of KDE Plasma, you'll be thrilled to hear they've announced a new Slimbook with an AMD CPU and the latest version of KDE Plasma desktop.
-
Monthly Sponsorship Includes Early Access to elementary OS 8
If you want to get a glimpse of what's in the pipeline for elementary OS 8, just set up a monthly sponsorship to help fund its continued existence.
-
DebConf24 to be Held in South Korea
Busan will be the location of the latest DebConf running July 28 through August 4