maximus Posted December 1 Posted December 1 I’ve been working on a module to store ProcessWire files directly on Backblaze B2, and wanted to share it with the community. Why I Built This I needed to host video content without breaking the bank on storage costs. AWS S3 was too expensive, and I wanted something that integrates seamlessly with ProcessWire’s existing file fields. Key Features 🚀 Direct B2 Upload - Files go straight to Backblaze, no local storage needed 💰 Dirt Cheap - $6/TB/month (AWS S3 costs 5x more) 🌐 Custom Domain Support - Use your own CDN domain ⚡ Cloudflare Integration - Combine with Cloudflare for FREE bandwidth 📦 Works with Repeaters - Multiple files per repeater item 🎬 Perfect for Video - Tested with Plyr, Video.js, and HTML5 video Real Cost Savings Here’s what I’m actually paying for 500GB of video storage: Backblaze B2 + Cloudflare: - Storage: $3/month - Bandwidth: $0 (free via Cloudflare Bandwidth Alliance) - Total: $3/month AWS S3 (same usage): - Storage: $11.50/month - Bandwidth: $450/month (5TB) - Total: $461.50/month That’s a 99% savings on bandwidth costs! How It Works The module extends ProcessWire’s file fields to upload directly to Backblaze B2. You can use it just like regular file fields: // Single video <video controls> <source src="<?= $page->b2_video->url ?>" type="video/mp4"> </video> // Multiple videos in repeater <?php foreach($page->videos as $item): ?> <?php foreach($item->b2_video as $video): ?> <video controls> <source src="<?= $video->b2url ?>" type="video/mp4"> </video> <?php endforeach; ?> <?php endforeach; ?> Cloudflare CDN Integration Want free bandwidth? Here’s the magic setup: CNAME: cdn.yourdomain.com → f005.backblazeb2.com (with Cloudflare proxy) Transform Rule: Rewrite paths to include /file/bucket-name/ Module setting: Enable custom domain Now all files serve through Cloudflare’s global CDN with zero bandwidth costs thanks to the Bandwidth Alliance partnership. Setup is Simple Create Backblaze B2 bucket Configure module with API keys Create field (type: FieldtypeFileB2) Add field to template Upload files - they go straight to B2! Optional: Add Cloudflare for free bandwidth and caching. Use Cases Video hosting (my use case) Large image galleries Audio files / podcasts Downloadable resources Any high-bandwidth file hosting Technical Details Works with public and private buckets Supports custom Cache-Control headers Files are deleted from local server after upload Can use custom domains via Cloudflare CORS configurable for cross-domain access Try It Out GitHub: https://github.com/mxmsmnv/FieldtypeFileB2 10 3
maximus Posted December 3 Author Posted December 3 Live demo running here: https://media.smnv.org/ Attached below is the full, ready-to-go 2025 site profile https://github.com/mxmsmnv/site-media It’s the complete real-world implementation of FieldtypeFileB2: videos served straight from Backblaze B2, zero bandwidth cost via Cloudflare, everything polished and production-ready. Grab it, use it, butcher it — whatever you need. 3 2
Ivan Gretsky Posted December 3 Posted December 3 Haven't tried the profile or field, but the walks in Switzerland videos are truly awesome) Wonder if page variations are being created well on the fly. Is it taken care of?
maximus Posted December 3 Author Posted December 3 10 hours ago, Ivan Gretsky said: Wonder if page variations are being created well on the fly. Is it taken care of? What do you mean?
Ivan Gretsky Posted December 3 Posted December 3 Hmm, I must have imagined your field was an image field, not a file field. My bad.
Ivan Gretsky Posted December 3 Posted December 3 What I was thinking about is PW image field creates variations of image (scaled down, resized and so on). And it does so not on image load, but during render. @maximus, you surely know about this. And PW puts all those into the same folder for all image fields of the same page. So I was wondering if and how this field handles those cases. I guess it does not as it is file field, not image. Or am I wrong?
maximus Posted December 3 Author Posted December 3 Yes, I tried to solve this problem yesterday,but there are two options you can use: https://images.weserv.nl/ or https://github.com/thumbor/thumbor Cloudflare Transformations didn't work for sundomains. You may use ProCache module by Ryan for caching images with CDN. 2
Ivan Gretsky Posted December 4 Posted December 4 That is what I thought. Thanks for extra research and tips.
jacmaes Posted December 7 Posted December 7 @maximus I have a subdomain with CloudFlare Image Transformations successfully running on it. Congrats on this wonderful module. Can't wait to try it out.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now