当前位置: 首页>>代码示例>>PHP>>正文


PHP MY_Controller::base方法代码示例

本文整理汇总了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;
 }
开发者ID:jbgae,项目名称:novamusica,代码行数:62,代码来源:imagen_model.php


注:本文中的MY_Controller::base方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。