我需要调整图像大小以适合 64x64 缩略图。我在做什么?我将调整宽度和高度设置为 64 像素。如果我设置 $config['maintain_ratio'] = false,图像会失去比例。我做了什么:我设置 $config['maintain_ratio'] = TRUE; 和 $config['master_dim'] = 'width'; 现在宽度始终为 64 像素,但高度更大。我必须以某种方式将图像高度从底部裁剪为 64px。我怎样才能做到这一点?我尝试设置裁剪功能,但失败了。也许还有另一种解决方案...我的调整大小功能
private function resize($up_data) {
$config['image_library'] = 'gd2';
$config['source_image'] = $up_data['full_path'];
$config['new_image'] = './images/autoriaithumb/';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['thumb_marker'] = '_thumb';
$config['width'] = 64;
$config['height'] = 64;
$config['quality'] = 100;
$config['master_dim'] = 'width';
$this->image_lib->initialize($config);
$this->image_lib->resize();
}