Beispiel #1
0
 public function updateBannerImage($file, $image_ext, $image_name, $destinationpath)
 {
     $return_arr = array();
     $config_path = \Config::get('webshoppack::shop_image_folder');
     CUtil::chkAndCreateFolder($config_path);
     // open file a image resource
     Image::make($file->getRealPath())->save(\Config::get("webshoppack::shop_image_folder") . $image_name . '_O.' . $image_ext);
     list($width, $height) = getimagesize($file);
     list($upload_img['width'], $upload_img['height']) = getimagesize(base_path() . '/public/' . $config_path . $image_name . '_O.' . $image_ext);
     $thumb_width = \Config::get("webshoppack::shop_image_thumb_width");
     $thumb_height = \Config::get("webshoppack::shop_image_thumb_height");
     if (isset($thumb_width) && isset($thumb_height)) {
         $timg_size = CUtil::DISP_IMAGE($thumb_width, $thumb_height, $upload_img['width'], $upload_img['height'], true);
         Image::make($file->getRealPath())->resize($thumb_width, $thumb_height, true, false)->save($config_path . $image_name . '_T.' . $image_ext);
     }
     $img_path = base_path() . '/public/' . $config_path;
     list($upload_input['thumb_width'], $upload_input['thumb_height']) = getimagesize($img_path . $image_name . '_T.' . $image_ext);
     if ($this->isShopAlreadyAdded()) {
         $this->deleteExistingImageFiles();
     }
     $return_arr = array('image_ext' => $image_ext, 'image_name' => $image_name, 'image_server_url' => $destinationpath, 't_width' => $upload_input['thumb_width'], 't_height' => $upload_input['thumb_height']);
     return $return_arr;
 }