protected function extractSettingVariables($file, $settings)
    {
        $variables = [];

        list($currentWidth, $currentHeight) = getimagesize($file);

        $variables['x']         = $settings['x']         ?? 0;
        $variables['y']         = $settings['y']         ?? 0;
        $variables['quality']   = $settings['quality']   ?? 0;
        $variables['prowidth']  = $settings['prowidth']  ?? NULL;
        $variables['proheight'] = $settings['proheight'] ?? NULL;
        $rewidth                = $settings['width']     ?? $currentWidth;
        $reheight               = $settings['height']    ?? $currentHeight;

        # Resizes the height value.
        if( ! empty($settings['reheight' ]) ) 
        {
            $height = $settings['reheight'];
        } 
        # It gives the width and height value proportional to the height value of the picture.
        elseif( ! empty($settings['proheight']) && $settings['proheight'] < $currentHeight )
        {
            $height = $settings['proheight'];
            $width  = round(($currentWidth * $height) / $currentHeight);    
        }  
        
        # Resizes the width value.
        if( ! empty($settings['rewidth'  ]) ) 
        {
            $width = $settings['rewidth' ];
        }
        # It gives the width and height value proportional to the width value of the picture.
        elseif( ! empty($settings['prowidth']) && $settings['prowidth'] < $currentWidth )
        {
            $width  = $settings['prowidth'];
            $height = round(($currentHeight * $width) / $currentWidth);   
        }

        # Gets width and height value information.
        $variables['width' ] = $width  ?? $rewidth;
        $variables['height'] = $height ?? $reheight;

        # The black portions are cut off.
        $variables['rWidth']  = $rewidth  - $variables['x'];
        $variables['rHeight'] = $reheight - $variables['y'];

        # Return setting variables.
        return $variables;
    }