private function register_image_sizes()
    {
        // No image sizes found.
        if (empty(Config::get('images.image_sizes')) && empty(Config::get('images.dynamic_image_sizes'))) {
            return;
        }

        $sizes = Config::get('images.image_sizes');

        // Merge in dynamic sizes if found
        if (! empty(Config::get('images.dynamic_image_sizes'))) {
            $sizes = \array_merge($sizes, Config::get('images.dynamic_image_sizes'));
        }

        // Loop through sizes.
        foreach ($sizes as $name => $size_info) {
            // Get size properties with basic fallbacks.
            $width = (int) isset($size_info[0]) ? $size_info[0] : 0;
            $height = (int) isset($size_info[1]) ? $size_info[1] : 0;
            $crop = isset($size_info[2]) ? $size_info[2] : false;

            if (\in_array($name, self::DEFAULT_IMAGE_SIZES)) {
                if ($size_info !== false) {
                    // Set other built-in sizes.
                    \update_option($name . '_size_w', $width);
                    \update_option($name . '_size_h', $height);
                    \update_option($name . '_crop', $crop);
                } else {
                    $callback = function ($sizes = []) use ($name) {
                        return \array_diff($sizes, [$name]);
                    };

                    // Remove the size.
                    $this->add_filter('intermediate_image_sizes_advanced', $callback);
                    $this->add_filter('intermediate_image_sizes', $callback);
                }
            } else {
                // Add custom image size.
                \add_image_size($name, $width, $height, $crop);
            }

            // If a custom dropdown name has been defined.
            if (isset($size_info[3]) && ! empty($size_info[3])) {
                $this->size_dropdown_names[ $name ] = $size_info[3];
            }
        }
    }
private function register_image_sizes()
    {
        // No image sizes found.
        if (empty(Config::get('images.image_sizes')) && empty(Config::get('images.dynamic_image_sizes'))) {
            return;
        }

        $sizes = Config::get('images.image_sizes');

        // Merge in dynamic sizes if found
        if (! empty(Config::get('images.dynamic_image_sizes'))) {
            $sizes = \array_merge($sizes, Config::get('images.dynamic_image_sizes'));
        }

        // Loop through sizes.
        foreach ($sizes as $name => $size_info) {
            // Get size properties with basic fallbacks.
            $width = (int) isset($size_info[0]) ? $size_info[0] : 0;
            $height = (int) isset($size_info[1]) ? $size_info[1] : 0;
            $crop = isset($size_info[2]) ? $size_info[2] : false;

            if (\in_array($name, self::DEFAULT_IMAGE_SIZES)) {
                if ($size_info !== false) {
                    // Set other built-in sizes.
                    \update_option($name . '_size_w', $width);
                    \update_option($name . '_size_h', $height);
                    \update_option($name . '_crop', $crop);
                } else {
                    $callback = function ($sizes = []) use ($name) {
                        return \array_diff($sizes, [$name]);
                    };

                    // Remove the size.
                    $this->add_filter('intermediate_image_sizes_advanced', $callback);
                    $this->add_filter('intermediate_image_sizes', $callback);
                }
            } else {
                // Add custom image size.
                \add_image_size($name, $width, $height, $crop);
            }

            // If a custom dropdown name has been defined.
            if (isset($size_info[3]) && ! empty($size_info[3])) {
                $this->size_dropdown_names[ $name ] = $size_info[3];
            }
        }
    }
private function register_image_sizes ( ) { // No image sizes found. if ( empty ( Config :: get ( 'images.image_sizes' ) ) && empty ( Config :: get ( 'images.dynamic_image_sizes' ) ) ) { return ; } $ sizes = Config :: get ( 'images.image_sizes' ) ; // Merge in dynamic sizes if found if ( ! empty ( Config :: get ( 'images.dynamic_image_sizes' ) ) ) { $ sizes = \ array_merge ( $ sizes , Config :: get ( 'images.dynamic_image_sizes' ) ) ; } // Loop through sizes. foreach ( $ sizes as $ name => $ size_info ) { // Get size properties with basic fallbacks. $ width = ( int ) isset ( $ size_info [ 0 ] ) ? $ size_info [ 0 ] : 0 ; $ height = ( int ) isset ( $ size_info [ 1 ] ) ? $ size_info [ 1 ] : 0 ; $ crop = isset ( $ size_info [ 2 ] ) ? $ size_info [ 2 ] : false ; if ( \ in_array ( $ name , self :: DEFAULT_IMAGE_SIZES ) ) { if ( $ size_info !== false ) { // Set other built-in sizes. \ update_option ( $ name . '_size_w' , $ width ) ; \ update_option ( $ name . '_size_h' , $ height ) ; \ update_option ( $ name . '_crop' , $ crop ) ; } else { $ callback = function ( $ sizes = [ ] ) use ( $ name ) { return \ array_diff ( $ sizes , [ $ name ] ) ; } ; // Remove the size. $ this -> add_filter ( 'intermediate_image_sizes_advanced' , $ callback ) ; $ this -> add_filter ( 'intermediate_image_sizes' , $ callback ) ; } } else { // Add custom image size. \ add_image_size ( $ name , $ width , $ height , $ crop ) ; } // If a custom dropdown name has been defined. if ( isset ( $ size_info [ 3 ] ) && ! empty ( $ size_info [ 3 ] ) ) { $ this -> size_dropdown_names [ $ name ] = $ size_info [ 3 ] ; } } }
Registers image sizes.

Also allows easy overwriting of default sizes, as well as the ability to disable them one by one.

@since 1.0.0
Registers image sizes .