本帖最后由 依然 于 2016-5-20 09:31 编辑
新人维护公司网站才接触CI不久,开发版本好像是2.x,对图片处理还不了解,手册试了下没能搞定,情况紧急不得已才伸手,求大神勿喷,问题如下:
上面图片点击图片后如下,想在下面张图片可以有放大查看的功能,如何实现?
方法代码如下:
function look_gallery($com_id,$album_id)
{
$data = array();
//
// $com = $this->coms_model->select_id($com_id,'accounts');
//
// if(!$com['is_pay'])
// {
//
// redirect('coms/mentions?redirect='.urlencode(current_url()));
//
// }
$data['com_id'] = $com_id;
$data['album_id'] = $album_id;
$data['account_infos'] = $this->coms_model->select_id($com_id,'accounts');
$rows = 6;
$offset = $this->uri->segment(5, 1);
//分页star
$config['uri_segment'] = '5';
$config['base_url'] = site_url('coms/look_gallery').'/'. $com_id . '/' .$album_id;
$config['total_rows'] = $this->coms_model->select_limit(array('term'=>array('album_id'=>$album_id),'return_count'=>1), 'account_photo');
$config['per_page'] = $rows;
$config['full_tag_open'] = '<li class="pagination">'; //把打开的标签放在所有结果的左侧
$config['full_tag_close'] = '</li>'; //把打开的标签放在所有结果的
$config['num_tag_open'] = '';
$config['num_tag_close'] = '';
$config['prev_link'] = '上一页';
$config['next_link'] = '下一页';
$config['next_tag_open'] = '<span class="next">';
$config['next_tag_close'] = '</span>';
$config['prev_tag_open'] = '<span class="prev">';
$config['prev_tag_close'] = '</span>';
$config['cur_tag_open'] = '<a class="current" href="javascript:void(0)">';
$config['cur_tag_close'] = '</a>';
$config['num_links'] = 9; //放在你当前页码的前面和后面的“数字”链接的数量
$config['use_page_numbers'] = TRUE;
$this->pagination->initialize($config);
//放到数组里面传给视图
$data['pagination'] = $this->pagination->create_links();
$gallery = $this->coms_model->select_id($album_id,'account_album');
$data['gallery_name'] = $gallery['name'];
// $hot_searchword = $data['account_infos']['hot_search'];
// $hot_searcharray = explode(',',$hot_searchword);
// $data['hot_search1'] = $hot_searcharray[0];
// $data['hot_search2'] = $hot_searcharray[1];
// $data['hot_search3'] = $hot_searcharray[2];
// $data['hot_search4'] = $hot_searcharray[3];
$data['info'] = $this->common_model->select_id($com_id,'accounts');
$data['photos'] = $this->coms_model->select_limit(array('term'=>array('album_id'=>$album_id),'limit'=>$rows,'page' => ($offset-1)*$rows),'account_photo');
$this->load->view($this->config->item('template_folder').'/default/look_gallery', $data);
}
function look_photo($com_id,$photo_id)
{
$data = array();
// $com = $this->coms_model->select_id($com_id,'accounts');
//
// if(!$com['is_pay'])
// {
//
// redirect('coms/mentions?redirect='.urlencode(current_url()));
//
// }
$data['com_id'] = $com_id;
$data['account_infos'] = $this->coms_model->select_id($com_id,'accounts');
$data['photo'] = $this->coms_model->select_id($photo_id,'account_photo');
// $hot_searchword = $data['account_infos']['hot_search'];
// $hot_searcharray = explode(',',$hot_searchword);
// $data['hot_search1'] = $hot_searcharray[0];
// $data['hot_search2'] = $hot_searcharray[1];
// $data['hot_search3'] = $hot_searcharray[2];
// $data['hot_search4'] = $hot_searcharray[3];
$data['info'] = $this->common_model->select_id($com_id,'accounts');
$this->load->view($this->config->item('template_folder').'/default/look_photo', $data);
}
|