Beispiel #1
0
function category_image_uploading($file)
{
    $ci =& get_instance();
    if ($file["name"] != "") {
        $time = time() . rand() . '_category';
        $category = array('file' => $file, 'new_name' => $time, 'dst_path' => $ci->config->item('image_path_category'));
        $category_response = upload_original($category);
        $src_path = $ci->config->item('image_path_category') . $category_response['file_name'];
        $category_thumbs = array(array('src_path' => $src_path, 'dst_path' => $ci->config->item('image_path_category'), 'image_x' => $ci->config->item('cat_image_medium_x'), 'image_y' => $ci->config->item('cat_image_medium_y'), 'image_ratio' => TRUE, 'image_ratio_fill' => TRUE, 'new_name' => $time . '_m'), array('src_path' => $src_path, 'dst_path' => $ci->config->item('image_path_category'), 'image_x' => $ci->config->item('cat_image_small_x'), 'image_y' => $ci->config->item('cat_image_small_y'), 'image_ratio' => TRUE, 'image_ratio_fill' => TRUE, 'new_name' => $time . '_s'));
        foreach ($category_thumbs as $category_thumb) {
            upload_resized_images($category_thumb);
        }
        return array('img_name' => $time, 'img_ext' => $category_response['file_ext']);
    }
    return array();
}
Beispiel #2
0
 function uploader()
 {
     // logo uploading
     if ($_FILES["image"]["name"] != "") {
         $time = time() . rand();
         $logo = array('file' => $_FILES["image"], 'new_name' => $time . '_logo', 'dst_path' => $this->config->item('image_path'));
         $logo_response = upload_original($logo);
         $src_path = $this->config->item('image_path') . $logo_response['file_name'];
         $logo_thumbs = array(array('src_path' => $src_path, 'dst_path' => $this->config->item('image_path'), 'image_x' => 239, 'image_y' => 87, 'image_ratio' => TRUE, 'image_ratio_fill' => TRUE, 'new_name' => $time . '_logo_m'), array('src_path' => $src_path, 'dst_path' => $this->config->item('image_path'), 'image_x' => 48, 'image_y' => 48, 'image_ratio' => TRUE, 'image_ratio_fill' => TRUE, 'new_name' => $time . '_logo_s'));
         foreach ($logo_thumbs as $logo_thumb) {
             upload_resized_images($logo_thumb);
         }
         $logo_name = $time;
         $logo_ext = $logo_response['file_ext'];
         echo $src_path;
     }
 }
Beispiel #3
0
 public function add_retailer_image()
 {
     $time = time() . rand();
     $logo = array('file' => $_FILES["userfile"], 'new_name' => $time . '_o', 'dst_path' => $this->config->item('retailer_image_path'));
     $logo_response = upload_original($logo);
     $src_path = $this->config->item('retailer_image_path') . $logo_response['file_name'];
     $logo_thumbs = array(array('src_path' => $src_path, 'dst_path' => $this->config->item('retailer_image_path'), 'image_x' => $this->config->item('retailer_image_large_x'), 'image_y' => $this->config->item('retailer_image_large_y'), 'image_ratio' => TRUE, 'image_ratio_fill' => TRUE, 'new_name' => $time . '_l'), array('src_path' => $src_path, 'dst_path' => $this->config->item('retailer_image_path'), 'image_x' => $this->config->item('retailer_image_medium_x'), 'image_y' => $this->config->item('retailer_image_medium_y'), 'image_ratio' => TRUE, 'image_ratio_fill' => TRUE, 'new_name' => $time . '_m'), array('src_path' => $src_path, 'dst_path' => $this->config->item('retailer_image_path'), 'image_x' => $this->config->item('retailer_image_small_x'), 'image_y' => $this->config->item('retailer_image_small_y'), 'image_ratio' => TRUE, 'image_ratio_fill' => TRUE, 'new_name' => $time . '_s'));
     foreach ($logo_thumbs as $logo_thumb) {
         upload_resized_images($logo_thumb);
     }
     echo json_encode(array('name' => $time, 'ext' => $logo_response['file_ext'], 'imagename' => other_asset_url($time . '_s.' . $logo_response['file_ext'], '', 'uploads/images/retailer')));
 }