<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_vehicles_img($uploadvalues); ?> ');"></div> <a href="javascript:void(0);" class="remove-photo-link" id="vehicles-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_vehicles_img($uploadvalues); ?> " style="display:none;"> <input type="hidden" name="uploadvalues" value="<?php echo $uploadvalues; ?> " /> </div> <?php } } ?> </div> <div id='imageloadstatus' style="display:none">
echo $travell->vechicle_type_id; ?> </td> <td class="gc_cell_left"><?php echo $travell->vechicle_type_name; ?> </td> <td class="gc_cell_left"><?php echo $travell->category_name; ?> </td> <td class="gc_cell_left"><?php if (!empty($travell->vechicle_image)) { ?> <img src="<?php echo theme_vehicles_img($travell->vechicle_image, 'small'); ?> "/> <?php } else { ?> <img src="<?php echo theme_img('no_car.png'); ?> "/> <?php } ?> </td> <td class="text-center"> <?php
function vehicles_image_upload() { $imagetype = $this->input->post('imageType'); $filename = $_FILES['vehiclesimg']['name']; $size = $_FILES['vehiclesimg']['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'] . '_vehicles_' . time() . "." . $ext; if (!$imagetype) { //config image upload $config['allowed_types'] = $this->config->item('acceptable_files'); $config['upload_path'] = $this->config->item('vehicles_upload_dir') . 'full'; $config['file_name'] = $actual_image_name; $config['remove_spaces'] = true; $this->load->library('upload', $config); if ($this->upload->do_upload('vehiclesimg')) { $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('vehicles_upload_dir') . 'full/' . $upload_data['file_name']; $config['new_image'] = $this->config->item('vehicles_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('vehicles_upload_dir') . 'medium/' . $upload_data['file_name']; $config['new_image'] = $this->config->item('vehicles_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('vehicles_upload_dir') . 'small/' . $upload_data['file_name']; $config['new_image'] = $this->config->item('vehicles_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="vehiclesimage"> <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_vehicles_img($upload_data['file_name']) . ');"></div> <a href="javascript:void(0);" class="remove-photo-link" id="vehicles-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_vehicles_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(); } } }