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
-
2024 Open Source Professionals Job Survey Now Open
Share your expectations regarding open source jobs.
-
Arch Linux 2023.12.01 Released with a Much-Improved Installer
If you've ever wanted to install Arch Linux, now is your time. With the latest release, the archinstall script vastly simplifies the process.
-
Zorin OS 17 Beta Available for Testing
The upcoming version of Zorin OS includes plenty of improvements to take your PC to a whole new level of user-friendliness.
-
Red Hat Migrates RHEL from Xorg to Wayland
If you've been wondering when Xorg will finally be a thing of the past, wonder no more, as Red Hat has made it clear.
-
PipeWire 1.0 Officially Released
PipeWire was created to take the place of the oft-troubled PulseAudio and has finally reached the 1.0 status as a major update with plenty of improvements and the usual bug fixes.
-
Rocky Linux 9.3 Available for Download
The latest version of the RHEL alternative is now available and brings back cloud and container images for ppc64le along with plenty of new features and fixes.
-
Ubuntu Budgie Shifts How to Tackle Wayland
Ubuntu Budgie has yet to make the switch to Wayland but with a change in approaches, they're finally on track to making it happen.
-
TUXEDO's New Ultraportable Linux Workstation Released
The TUXEDO Pulse 14 blends portability with power, thanks to the AMD Ryzen 7 7840HS CPU.
-
AlmaLinux Will No Longer Be "Just Another RHEL Clone"
With the release of AlmaLinux 9.3, the distribution will be built entirely from upstream sources.
-
elementary OS 8 Has a Big Surprise in Store
When elementary OS 8 finally arrives, it will not only be based on Ubuntu 24.04 but it will also default to Wayland for better performance and security.