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
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.