function testimonials_image_upload() { $imagetype = $this->input->post('imageType'); $filename = $_FILES['testimonialsimg']['name']; $size = $_FILES['testimonialsimg']['size']; //get the extension of the file in a lower case format $ext = $this->getExtension($filename); $ext = strtolower($ext); $actual_image_name = 'user' . $this->user['id'] . '_testimonials_' . time() . "." . $ext; if (!$imagetype) { //config image upload $config['allowed_types'] = $this->config->item('acceptable_files'); $config['upload_path'] = $this->config->item('testimonials_upload_dir') . 'full'; $config['file_name'] = $actual_image_name; $config['remove_spaces'] = true; $this->load->library('upload', $config); if ($this->upload->do_upload('testimonialsimg')) { $upload_data = $this->upload->data(); $this->load->library('image_lib'); //this is the larger image $config['image_library'] = 'gd2'; $config['source_image'] = $this->config->item('testimonials_upload_dir') . 'full/' . $upload_data['file_name']; $config['new_image'] = $this->config->item('testimonials_upload_dir') . 'medium/' . $upload_data['file_name']; $config['maintain_ratio'] = TRUE; $config['width'] = 600; $config['height'] = 500; $this->image_lib->initialize($config); $this->image_lib->resize(); $this->image_lib->clear(); //small image $config['image_library'] = 'gd2'; $config['source_image'] = $this->config->item('testimonials_upload_dir') . 'medium/' . $upload_data['file_name']; $config['new_image'] = $this->config->item('testimonials_upload_dir') . 'small/' . $upload_data['file_name']; $config['maintain_ratio'] = TRUE; $config['width'] = 235; $config['height'] = 235; $this->image_lib->initialize($config); $this->image_lib->resize(); $this->image_lib->clear(); //cropped thumbnail $config['image_library'] = 'gd2'; $config['source_image'] = $this->config->item('testimonials_upload_dir') . 'small/' . $upload_data['file_name']; $config['new_image'] = $this->config->item('testimonials_upload_dir') . 'thumbnails/' . $upload_data['file_name']; $config['maintain_ratio'] = TRUE; $config['width'] = 150; $config['height'] = 150; $this->image_lib->initialize($config); $this->image_lib->resize(); $this->image_lib->clear(); if ($upload_data) { $style = '<div id="gallery-photos-wrapper" class="testimonialsimage"> <ul id="gallery-photos" class="clearfix gallery-photos gallery-photos-hover ui-sortable"> <li id="recordsArray_1" class="col-md-2 col-sm-3 col-xs-6" style="width:45%"> <div class="photo-box" style="background-image: url(' . theme_testimonials_img($upload_data['file_name']) . ');"></div> <a href="javascript:void(0);" class="remove-photo-link" id="testimonials-img-remove"> <span class="fa-stack fa-lg"> <i class="fa fa-circle fa-stack-2x"></i> <i class="fa fa-trash-o fa-stack-1x fa-inverse"></i> </span> </a> </li> </ul> <img src="' . theme_testimonials_img($upload_data['file_name']) . '" style="display:none;"> <input type="hidden" name="uploadvalues" value="' . $upload_data['file_name'] . '" /> </div>'; echo $style; } } if ($this->upload->display_errors() != '') { echo $this->upload->display_errors(); } } }
echo lang('testimonials'); ?> </h2> <ul> <?php if (!empty($testimonials)) { foreach ($testimonials as $testimonial) { ?> <li> <div class="rr-lft re-lft fleft"> <div class="recent-img rrimg"> <img src="<?php if (!empty($testimonial['image'])) { echo theme_testimonials_img($testimonial['image']); } else { echo theme_img('mem-img1.jpg'); } ?> "> </div> <h3><?php echo $testimonial['name']; ?> </h3> </div> <p class="test-rht-bx"> <span class="lft-arr-ic"> <img src="<?php echo theme_img('left-arrow-ico.png'); ?> "></span> <span style="font-family:Arial;"> " </span> <?php
<ul id="gallery-photos" class="clearfix gallery-photos gallery-photos-hover ui-sortable"> <li id="recordsArray_1" class="col-md-2 col-sm-3 col-xs-6" style="width:45%"> <div class="photo-box" style="background-image: url('<?php echo theme_testimonials_img($uploadvalues); ?> ');"></div> <a href="javascript:void(0);" class="remove-photo-link" id="testimonials-img-remove"> <span class="fa-stack fa-lg"> <i class="fa fa-circle fa-stack-2x"></i> <i class="fa fa-trash-o fa-stack-1x fa-inverse"></i> </span> </a> </li> </ul> <img src="'<?php echo theme_testimonials_img($uploadvalues); ?> " style="display:none;"> <input type="hidden" name="uploadvalues" value="<?php echo $uploadvalues; ?> " /> </div> <?php } } ?> </div> <div id='imageloadstatus' style="display:none">