Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View lfjeff's full-sized avatar

Jeff Groves lfjeff

  • Phoenix
View GitHub Profile
@lfjeff
lfjeff / AppExtension.php
Last active January 13, 2019 18:11
Create Symfony 4 Twig image_proc() function to optimize images using images.weserv.nl
<?php
// src/Twig/AppExtension.php
namespace App\Twig;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
class AppExtension extends AbstractExtension
@lfjeff
lfjeff / serve_s3_images_from_own_domain.js
Created June 11, 2018 03:09
Serve S3 images from your own domain using Cloudflare worker
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
/**
* When we receive a request, fetch it from our S3 bucket
*
* For example, a request for:
* https://mydomain.com/images/castle01.jpg
* will be fetched from: