I am using GalleryCms that is based of codeigniter. Currently the cms has values for height and width and it sizes the thumbnails to the longest edge. I am wanting to get the thumbnails cropped square. Any ideas? I’m not much of a coder so it has been guessing for me.
There are two places I see thumbnail stuff:
Image.php has this:
// Create thumbnail
$config['image_library'] = 'gd2';
$config['source_image'] = './uploads/' . $upload_info['file_name'];
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = $album_config->thumb_width;
$config['height'] = $album_config->thumb_height;
// TODO Handle cropping.
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$this->image_lib->clear();
and album.php has this:
// Update all album's thumbnails
$images = $this->image_model->get_images_by_album_id($album_id);
if ( ! empty($images))
{
$this->load->library('image_lib');
$config = array();
foreach ($images as $image)
{
$config['image_library'] = 'gd2';
$config['source_image'] = './uploads/' . $image->file_name;
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = $this->input->post('thumb_width');
$config['height'] = $this->input->post('thumb_height');
$config['thumb_marker'] = '_thumb';
// TODO Handle cropping
$this->image_lib->initialize($config);
$this->image_lib->resize();
$this->image_lib->clear();
$config = array();
}
}
$now = date('Y-m-d H:i:s');
$this->album_model->update(array('updated_at' => $now), $album_id);
redirect("album/images/$album_id");
return;
}
}
