本文整理汇总了PHP中MY_Controller::base方法的典型用法代码示例。如果您正苦于以下问题:PHP MY_Controller::base方法的具体用法?PHP MY_Controller::base怎么用?PHP MY_Controller::base使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MY_Controller
的用法示例。
在下文中一共展示了MY_Controller::base方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actualizar
public function actualizar($codigo, $tipo = 'foto')
{
$aux = FALSE;
$path = getcwd();
if (!is_dir(realpath($path . DIRECTORY_SEPARATOR . "images" . DIRECTORY_SEPARATOR . "paginas" . DIRECTORY_SEPARATOR))) {
mkdir($path . DIRECTORY_SEPARATOR . "images" . DIRECTORY_SEPARATOR . "paginas" . DIRECTORY_SEPARATOR, 0755);
}
$config['upload_path'] = realpath("{$path}/images/paginas/");
$config['allowed_types'] = 'gif|jpg|jpeg|png|PNG|JPG|JPEG|GIF';
$config['max_size'] = '0';
$config['max_width'] = '0';
$config['max_height'] = '0';
$this->load->library('upload', $config);
$ruta = str_replace(MY_Controller::base(), realpath($path), $this->ruta($codigo));
if (file_exists($ruta)) {
if (substr($ruta, -1) != '/') {
if (unlink($ruta)) {
$aux = TRUE;
log_message('info', 'La imagen ha sido borrada con éxito');
} else {
$aux = FALSE;
log_message('error', 'La imagen no ha sido borrada');
}
}
}
if ($this->upload->do_upload('archivo')) {
log_message('info', 'La nueva imagen ha sido subida con éxito');
$foto = $this->upload->data();
$config['image_library'] = 'gd2';
//CARPETA EN LA QUE ESTÁ LA IMAGEN A REDIMENSIONAR
$config['source_image'] = realpath($path . DIRECTORY_SEPARATOR . "images" . DIRECTORY_SEPARATOR . "paginas" . DIRECTORY_SEPARATOR . $foto['file_name']);
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['new_image'] = realpath($path . DIRECTORY_SEPARATOR . "images" . DIRECTORY_SEPARATOR . "paginas" . DIRECTORY_SEPARATOR);
if ($tipo == 'foto') {
$config['width'] = 220;
$config['height'] = 220;
} else {
$config['width'] = 960;
$config['height'] = 350;
}
$this->image_lib->initialize($config);
if (!$this->image_lib->resize()) {
log_message('error', "Error imagen:" . $this->image_lib->display_errors());
}
$this->image_lib->clear();
unlink(realpath($path . DIRECTORY_SEPARATOR . "images" . DIRECTORY_SEPARATOR . "paginas" . DIRECTORY_SEPARATOR . $foto['file_name']));
$this->Codigo = $codigo;
$this->Ruta = base_url() . 'images/paginas/' . $foto['raw_name'] . '_thumb' . $foto['file_ext'];
$this->Nombre = $foto['raw_name'];
$this->Extension = $foto['file_ext'];
$this->Tamanyo = $foto['file_size'];
if ($this->db->update('Imagen', $this, array('Codigo' => $codigo))) {
$aux = TRUE;
} else {
log_message('error', "Error imagen: No se ha introducido en la BD");
}
} else {
log_message('error', "Error imagen:" . $this->upload->display_errors());
}
return $aux;
}