You can use $config['master_dim'] = 'width' to determine which axis should be used as the hard value.
See https://ellislab.com/codeigniter/user-guide/libraries/image_lib.html
And I wonder if there's another way, because in order to keep radio, CI would need to determine which axis is the limit. If I were the developer, I would calculate the ratio of real width to desired width and the ratio of real height and desired height, then the larger ratio indicates the limit. So the limited axis size is just the desired size, and divide the real size of the other axis by this ratio would be the result size of the other axis. In this case, if I want to have a fixed width while keeping ratio, I just set height to a very large number, so that the resizer will actually ignore it, since the ratio of real height to desired height is far smaller than the ratio of real width and desired width. Then the result would be width fixed.
But when I set the height to PHP_INT_MAX, it throws out an error. I looked into the source code and found out CI did the calculation like this:
$new_width = ceil($this->orig_width*$this->height/$this->orig_height);
$new_height = ceil($this->width*$this->orig_height/$this->orig_width);
$ratio = (($this->orig_height/$this->orig_width) - ($this->height/$this->width));
So if I set height to PHP_INT_MAX, it'll exceed integer limit when doing multiplication.