Я получаю черную область, чтобы справиться с этим с помощью CI, изображение имеет разрешение 950x720.
первое изменение размера в порядке $this->resize($data['upload_data']['full_path'], 220, 200, true, false); а во втором вылезает ошибка
код по сути: https://gist.github.com/mateuspv/48ba464a557da9bbdf10
<?php
/**
* resize
* @param string $path [description]
* @param int $width [description]
* @param int $height [description]
* @param boolean $thumb [description]
* @param boolean $ratio [description]
*/
private function resize($path, $width, $height, $thumb, $ratio) {
$config['image_library'] = 'GD2';
$config['source_image'] = $path;
$config['maintain_ratio'] = $ratio;
$config['create_thumb'] = $thumb;
$config['encrypt_name'] = TRUE;
$config['width'] = $width;
$config['height'] = $height;
$this->image_lib->clear();
$this->image_lib->initialize($config);
$this->image_lib->resize();
if (!$this->image_lib->resize()) {
die($this->image_lib->display_errors());
}
}
//...
/**
* TODO ~
*/
$data = array('upload_data' => $this->upload->data());
$this->resize($data['upload_data']['full_path'], 220, 200, true, false);
$this->resize($data['upload_data']['full_path'], 450, 450, false, false);