Skip to content

Instantly share code, notes, and snippets.

@peterrattew-old
peterrattew-old / functions.php
Created March 21, 2017 16:02
On the fly resizing with Wordpress and NGINX
<?php
add_filter('image_downsize', 'custom_image_downsize', 10, 3);
function custom_image_downsize($value = false, $post_id, $size = 'medium') {
global $_wp_additional_image_sizes;
if(is_array($size)) {
$width = (int) @$size[0];
$height = (int) @$size[1];
$crop = (@$size[2]) ? 'c' : '';

Keybase proof

I hereby claim:

  • I am peterrattew on github.
  • I am peterrattew (https://keybase.io/peterrattew) on keybase.
  • I have a public key ASDYnfvmBHDDDxxudqgtFCEvaFPDGEI-AIzxzIzm4hVOtwo

To claim this, I am signing this object: