├── LICENSE ├── README.md ├── wp-cli.phar └── wp-jit-image-sizes.php /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Kurtis Shaner 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JIT Image Sizes 2 | 3 | JIT (Just in Time) Image Sizes is a WordPress Plugin that tell WordPress not to create a thumbnail for every size that is registered, but only create it whenever it is requested by the front end of the site. 4 | 5 | When thumbnails are (re) generated via upload, another plugin or wp-cli, they are actually deleted and re-generated again the next time they are requested. This is ideal for large sites with a large amount of image assets in the media library. 6 | 7 | **This plugin is still in development and is not recommended for use on production sites** 8 | -------------------------------------------------------------------------------- /wp-cli.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wdgdc/wp-jit-image-size/eef1663a8b4e7aeaf8d31e22a3c680ed953a86e9/wp-cli.phar -------------------------------------------------------------------------------- /wp-jit-image-sizes.php: -------------------------------------------------------------------------------- 1 | whitelist = get_option('wp-jit-image-size-whitelist'); 35 | if (is_array($this->whitelist)) $this->whitelist = array_keys($this->whitelist); 36 | } 37 | 38 | public function admin_init() { 39 | add_action('wp_ajax_jit_image_sizes_thumbnail_delete_count', array($this, 'wp_ajax_jit_image_sizes_thumbnail_delete_count')); 40 | add_action('wp_ajax_jit_image_sizes_thumbnail_delete', array($this, 'wp_ajax_jit_image_sizes_thumbnail_delete')); 41 | add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2); 42 | 43 | add_settings_section('wp-jit-image-size-settings', '', null, 'wp-jit-image-sizes'); 44 | register_setting('wp-jit-image-sizes', 'wp-jit-image-size-whitelist'); 45 | add_settings_field('wp-jit-image-size-whitelist', 'Whitelist Image Sizes to Generate', array($this, 'setting_wp_jit_image_size_whitelist'), 'wp-jit-image-sizes', 'wp-jit-image-size-settings'); 46 | // add_settings_field('wp-jit-image-size-delete-thumbs', 'Delete All Thumbnails', array($this, 'setting_wp_jit_image_size_delete_thumbs'), 'wp-jit-image-sizes', 'wp-jit-image-size-settings'); 47 | } 48 | 49 | public function setting_wp_jit_image_size_delete_thumbs() { ?> 50 |
51 | 134 | 140 |