static function getOrderGoodsInfo($goods_id) { $data = Sys::M(self::$trueTableName)->select('`logo`,`name`,`price`,`discount_price`', '`id`=' . $goods_id, 1); if (empty($data)) { $data = array('logo' => 0, 'name' => '', 'price' => 0, 'discount_price' => 0); } Sys::D('Image'); $imgData = ImageModel::getImageInfo($data['logo']); return array_merge($data, $imgData); }
public static function createImageModel($image_file_name) { if (empty($image_file_name)) { return null; } $image = new ImageModel(); $image->imgType = ImageModel::getImgTypeByExtension($image_file_name); $image->data = file_get_contents(app_path() . '/storage/uploads/' . $image_file_name); return $image; }
public function projectAction() { $image_model = new ImageModel(); $project_model = new ProjectModel(); $contribution_model = new ContributionModel(); $active_projects = $project_model->getActive(); //Build thumbs array from active projects $thumbs = array(); foreach ($active_projects as $project) { $thumbs[] = $image_model->getPrimary($project['id']); } $this->view->thumbs = $thumbs; $project_id = $this->_request->getParam('id'); $view_id = $this->_request->getParam('view'); if ($this->is_ajax) { $project_id = $_POST['id']; } if (!$project_id) { $thumbs = reset($thumbs); $project_id = $thumbs['project_id']; } $this->project = $project_model->getOne($project_id); $this->project['description'] = stripslashes($this->project['description']); $this->project['contributions'] = $contribution_model->getOne($project_id); $this->project['images'] = $image_model->getAll($project_id); //If the view is set, loop through the images and find the file_name that matches if (isset($view_id)) { foreach ($this->project['images'] as $image) { if ($image['id'] == $view_id) { $this->project['view'] = $image['file_name']; } } } else { //Else just assume the first file_name $this->project['view'] = $this->project['images']['image1']['file_name']; } if ($this->is_ajax) { $this->_helper->json($this->project); } $this->view->project = $this->project; }
public function profile() { $file = Input::file('uploader'); $destinationPath = app_path() . '/storage/uploads/'; $filename = $file->getClientOriginalName(); Input::file('uploader')->move($destinationPath, $filename); $image = ImageModel::createImageModel($filename); try { $session = Session::get('user'); $userService = new SoapClient(Config::get('wsdl.user')); $currentUser = $userService->getUserById(array("userId" => $session['data']->id)); $currentUser = $currentUser->user; $currentUser->avatar = $image; $result = $userService->updateUser(array("user" => $currentUser)); return Response::json($result->complete); } catch (Exception $ex) { } }
public function updateShipping() { try { $adminService = new SoapClient(Config::get('wsdl.admin'), array()); $shipping = new ShippingModel(); $shipping->id = Input::get('shippingId'); $shipping->trackingNumber = Input::get('trackingNumber'); $shipping->receivedAmount = Input::get('receivedAmount'); if (Input::get('barcodeImage') != null) { $shipping->image = Input::get('barcodeImage'); $shipping->barcodeImage = ImageModel::createImageModel(str_replace('api/image/', '', $shipping->image['url'])); } $result = $adminService->updateShipping(array("shipping" => $shipping)); return array('status' => 'valid'); } catch (Exception $ex) { return array('status' => 'failed'); } }
public function updateContent($attractionBO) { if (isset($attractionBO->postBO)) { $postBO = $attractionBO->postBO; try { $sql = "UPDATE " . TABLE_POSTS . " "; $set = "SET "; $where = " WHERE " . TB_POST_COL_ID . " = :post_id;"; $para_array = []; $para_array[":post_id"] = $postBO->ID; if (isset($attractionBO->name)) { $postBO->post_title = $attractionBO->name; $set .= " " . TB_POST_COL_POST_TITLE . " = :post_title,"; $para_array[":post_title"] = $postBO->post_title; } if (isset($attractionBO->post_content_1) || isset($attractionBO->post_content_2)) { $post_content = new stdClass(); if (isset($attractionBO->post_content_1)) { $post_content->post_content_1 = $attractionBO->post_content_1; } if (isset($attractionBO->post_content_2)) { $post_content->post_content_2 = $attractionBO->post_content_2; } $postBO->post_content = json_encode($post_content); $set .= " " . TB_POST_COL_POST_CONTENT . " = :post_content,"; $para_array[":post_content"] = $postBO->post_content; } if (isset($attractionBO->name)) { $postBO->post_name = Utils::createSlug($attractionBO->name); $set .= " " . TB_POST_COL_POST_NAME . " = :post_name,"; $para_array[":post_name"] = $postBO->post_name; } if (isset($postBO->image_ids)) { $image_ids = json_decode($postBO->image_ids); } else { $image_ids = array(); } Model::autoloadModel("image"); $imageModel = new ImageModel($this->db); if (isset($attractionBO->images_upload)) { $imageModel->is_create_thumb = true; $imageModel->is_slider_thumb = true; $imageModel->is_large = true; // $imageModel->slider_thumb_crop = true; $image_array_id = $imageModel->uploadImages("images"); if (!is_null($image_array_id) && is_array($image_array_id) && sizeof($image_array_id) != 0) { $image_ids = array_merge($image_ids, $image_array_id); } else { return FALSE; } } if (isset($attractionBO->image_delete_list) && $attractionBO->image_delete_list != "" && $attractionBO->image_delete_list != NULL) { $image_delete_array = explode(",", $attractionBO->image_delete_list); if (count($image_delete_array) > 0) { foreach ($image_delete_array as $image_delete_id) { $image_ids = array_diff($image_ids, [$image_delete_id]); // array_slice($image_ids, $image_delete_id, 1); } } } if (count($para_array) != 0) { $set = substr($set, 0, strlen($set) - 1); $sql .= $set . $where; $sth = $this->db->prepare($sql); $sth->execute($para_array); Model::autoloadModel("post"); $postModel = new PostModel($this->db); $image_ids = json_encode($image_ids); if (isset($image_ids) && $image_ids != "") { if (isset($postBO->image_ids)) { if (!$postModel->updateMetaInfoToDatabase($postBO->ID, "image_ids", $image_ids)) { if (isset($imageModel) && isset($image_array_id)) { foreach ($image_array_id as $image_id) { $imageModel->delete($image_id); } } return FALSE; } else { //thanh cong xoa image bi tich bo if (isset($imageModel) && isset($image_delete_array)) { foreach ($image_delete_array as $image_id) { $imageModel->delete($image_id); } } } } else { if (!$postModel->addMetaInfoToDatabase($postBO->ID, "image_ids", $image_ids)) { if (isset($imageModel) && isset($image_array_id)) { foreach ($image_array_id as $image_id) { $imageModel->delete($image_id); } } return FALSE; } else { //thanh cong xoa image bi tich bo if (isset($imageModel) && isset($image_delete_array)) { foreach ($image_delete_array as $image_id) { $imageModel->delete($image_id); } } } } } return TRUE; } } catch (Exception $e) { } } }
public function updateContent($countryBO) { if (isset($countryBO->postBO)) { $postBO = $countryBO->postBO; try { $sql = "UPDATE " . TABLE_POSTS . " "; $set = "SET "; $where = " WHERE " . TB_POST_COL_ID . " = :post_id;"; $para_array = []; $para_array[":post_id"] = $postBO->ID; if (isset($countryBO->name)) { $postBO->post_title = $countryBO->name; $set .= " " . TB_POST_COL_POST_TITLE . " = :post_title,"; $para_array[":post_title"] = $postBO->post_title; } if (isset($countryBO->overview) || isset($countryBO->history) || isset($countryBO->weather) || isset($countryBO->passport_visa) || isset($countryBO->currency) || isset($countryBO->phone_internet_service) || isset($countryBO->transportation) || isset($countryBO->food_drink) || isset($countryBO->public_holiday) || isset($countryBO->predeparture_check_list)) { $post_content = new stdClass(); if (isset($countryBO->overview)) { $post_content->overview = $countryBO->overview; } if (isset($countryBO->history)) { $post_content->history = $countryBO->history; } if (isset($countryBO->weather)) { $post_content->weather = $countryBO->weather; } if (isset($countryBO->passport_visa)) { $post_content->passport_visa = $countryBO->passport_visa; } if (isset($countryBO->currency)) { $post_content->currency = $countryBO->currency; } if (isset($countryBO->phone_internet_service)) { $post_content->phone_internet_service = $countryBO->phone_internet_service; } if (isset($countryBO->transportation)) { $post_content->transportation = $countryBO->transportation; } if (isset($countryBO->food_drink)) { $post_content->food_drink = $countryBO->food_drink; } if (isset($countryBO->public_holiday)) { $post_content->public_holiday = $countryBO->public_holiday; } if (isset($countryBO->predeparture_check_list)) { $post_content->predeparture_check_list = $countryBO->predeparture_check_list; } $postBO->post_content = json_encode($post_content); $set .= " " . TB_POST_COL_POST_CONTENT . " = :post_content,"; $para_array[":post_content"] = $postBO->post_content; } if (isset($countryBO->name)) { $postBO->post_name = Utils::createSlug($countryBO->name); $set .= " " . TB_POST_COL_POST_NAME . " = :post_name,"; $para_array[":post_name"] = $postBO->post_name; } if (isset($postBO->image_weather_ids)) { $image_weather_ids = json_decode($postBO->image_weather_ids); } else { $image_weather_ids = array(); } Model::autoloadModel("image"); $imageModel = new ImageModel($this->db); if (isset($countryBO->image_weathers_upload)) { $imageModel->is_create_thumb = true; $imageModel->is_slider_thumb = true; $imageModel->is_medium_large = true; // $imageModel->slider_thumb_crop = true; $image_array_id = $imageModel->uploadImages("image_weathers"); if (!is_null($image_array_id) && is_array($image_array_id) && sizeof($image_array_id) != 0) { $image_weather_ids = array_merge($image_weather_ids, $image_array_id); } else { return FALSE; } } if (isset($countryBO->image_weather_delete_list) && $countryBO->image_weather_delete_list != "" && $countryBO->image_weather_delete_list != NULL) { $image_weather_delete_array = explode(",", $countryBO->image_weather_delete_list); if (count($image_weather_delete_array) > 0) { foreach ($image_weather_delete_array as $image_delete_id) { $image_weather_ids = array_diff($image_weather_ids, [$image_delete_id]); // array_slice($image_weather_ids, $image_delete_id, 1); // array_slice($image_weather_ids, $image_delete_id); } } } if (count($para_array) != 0) { $set = substr($set, 0, strlen($set) - 1); $sql .= $set . $where; $sth = $this->db->prepare($sql); $sth->execute($para_array); Model::autoloadModel("post"); $postModel = new PostModel($this->db); $image_weather_ids = json_encode($image_weather_ids); if (isset($image_weather_ids) && $image_weather_ids != "") { if (isset($postBO->image_weather_ids)) { if (!$postModel->updateMetaInfoToDatabase($postBO->ID, "image_weather_ids", $image_weather_ids)) { if (isset($imageModel) && isset($image_array_id)) { foreach ($image_array_id as $image_weather_id) { $imageModel->delete($image_weather_id); } } return FALSE; } else { //thanh cong xoa image bi tich bo if (isset($imageModel) && isset($image_weather_delete_array)) { foreach ($image_weather_delete_array as $image_weather_id) { $imageModel->delete($image_weather_id); } } } } else { if (!$postModel->addMetaInfoToDatabase($postBO->ID, "image_weather_ids", $image_weather_ids)) { if (isset($imageModel) && isset($image_array_id)) { foreach ($image_array_id as $image_weather_id) { $imageModel->delete($image_weather_id); } } return FALSE; } else { //thanh cong xoa image bi tich bo if (isset($imageModel) && isset($image_weather_delete_array)) { foreach ($image_weather_delete_array as $image_weather_id) { $imageModel->delete($image_weather_id); } } } } } return TRUE; } } catch (Exception $e) { } } }
public function get_visita($animalistaUUID) { session_start(); if ($animalistaUUID == null) { return Redirect::to("/"); } $user = $this->getUserByEmail($_SESSION["email"]); $img = new ImageModel(); $images = $img->mGetByUUId($animalistaUUID); $animalistaObject = new AnimalistaModel(); $profile = $animalistaObject->mGetAnimalistaByUUID($animalistaUUID); $user_animalista = new UsuariosModel(); $name_animalista = $user_animalista->getByuuid($profile["user_uuid"]); $profile["nombre"] = $name_animalista["nombre"]; return View::make("user-visita", array("profile" => $profile, "images" => $images, "user" => $user)); }
/** * Upload an image via form-data. * Allowed only .jpg format. * * Optional parameters: (lat, lon), tag, description. */ function index_post() { header('Access-Control-Allow-Origin: *'); if (!isset($_FILES['image'])) { $this->response(error('Provide \'image\' parameter.', 400), 400); return; } $imageBytes = $_FILES['image']; $imageDescription = $this->post('description'); $lat = $this->post('lat'); $lon = $this->post('lon'); $location = null; if ($lat != null && $lon != null) { $location = new Location(); $location->setLat((double) $lat); $location->setLon((double) $lon); } $tagValue = $this->post('tag'); $tag = null; if ($tagValue != null) { $tag = new Tag(); $tag->setValue($tagValue); } $imageModel = new ImageModel($this->db); try { $image = $imageModel->createImage($imageBytes, $imageDescription, $tag, $location); $this->response($image->serialize(), 201); } catch (ImageAlreadyExistsException $e) { $this->response(error('Image already exists.', 409), 409); } catch (InvalidImageExtensionException $e) { $this->response(error('Invalid image extension. Allowed only .jpg.', 400), 400); } }
public function CreateImage($param) { parent::CreateImageProcess($param); }
private function imageExists($sha1) { $imageModel = new ImageModel($this->db); return $imageModel->getImageByHash($sha1) != null; }
public function editAction() { if (!isset($this->admin_session->user)) { header("Location: /"); } $image_model = new ImageModel(); $project_model = new ProjectModel(); $contributions_model = new ContributionModel(); $project_id = $this->_request->getParam('id'); $this->project = $project_model->getOne($project_id); $this->project['description'] = stripslashes($this->project['description']); $this->project['images'] = $image_model->getAll($project_id); $contributions = ''; foreach ($contributions_model->getOne($project_id) as $contribution) { $contributions .= $contribution['contribution'] . ', '; } $this->project['contributions'] = $contributions; $this->view->project = $this->project; }
public function get_visita($mascotaid) { if ($mascotaid == null) { return Redirect::to("/"); } session_start(); $user = new UsuariosController(); $userData = $user->getUserByEmail($_SESSION["email"]); $mascotaModel = new MascotaModel(); $mascotaData = $mascotaModel->mMascotaByUUID($mascotaid); $img = new ImageModel(); $images = $img->mGetByUUId($mascotaData["uuid"]); return View::make("mascota-visita", array("mascota" => $mascotaData, "images" => $images, "user" => $userData)); }
public function ClearCover($param) { parent::ClearCoverProcess($param); }
/** * Update a specified ad. * * @param int $id * @return Response */ public function update($id) { try { $session = Session::get('user'); $adService = new SoapClient(Config::get('wsdl.ad'), array()); $result = $adService->getAdById(array("adId" => $id)); $ad = new Ad($result->ad); $update = Input::get('ad'); foreach ($update as $k => $v) { $ad->{$k} = $v; } if (isset($update['image']['url']) && !is_array($update['image']['url'])) { $ad->image = ImageModel::createImageModel(str_replace('api/image/', '', $update['image']['url'])); } else { if (isset($update['image']['url'])) { $ad->image = $update['image']['url']; } else { $ad->image = null; } } $times = array('availableFromTime', 'availableToTime', 'redemptionEndDate'); foreach ($times as $time) { if (isset($update[$time])) { $ad->{$time} = strtotime($update[$time]); } } $result = $adService->updateAd(array("ad" => $ad)); } catch (Exception $ex) { throw new Exception($ex->getMessage()); } }
public function getMetaInfo($user_id) { $sth = $this->db->prepare("SELECT *\n FROM " . TABLE_USERMETA . "\n WHERE " . TB_USERMETA_COL_USER_ID . " = :user_id"); $sth->execute(array(':user_id' => $user_id)); $count = $sth->rowCount(); if ($count > 0) { $userMetaInfoArray = $sth->fetchAll(); foreach ($userMetaInfoArray as $userMeta) { if (isset($userMeta->meta_key) && in_array($userMeta->meta_key, array("manage_users_columns_show", "manage_countries_columns_show", "manage_cities_columns_show", "manage_hotels_columns_show", "manage_restaurants_columns_show", "manage_shoppings_columns_show", "manage_internalflights_columns_show", "manage_internationalflights_columns_show", "manage_activities_columns_show", "manage_nightlifes_columns_show", "manage_tags_columns_show", "manage_destinations_columns_show", "manage_eats_columns_show", "manage_styles_columns_show", "manage_types_columns_show"))) { try { $userMeta->meta_value = json_decode($userMeta->meta_value); } catch (Exception $e) { $userMeta->meta_value = NULL; } } if (isset($userMeta->meta_key) && $userMeta->meta_key == "avatar") { Model::autoloadModel('image'); $imageModel = new ImageModel($this->db); $avatar_object = new stdClass(); $avatar_object->umeta_id = $userMeta->umeta_id; $avatar_object->user_id = $userMeta->user_id; $avatar_object->meta_key = 'avatar_object'; $avatar_object->meta_value = $imageModel->get($userMeta->meta_value); $userMetaInfoArray[] = $avatar_object; } } return $userMetaInfoArray; } else { $_SESSION["fb_error"][] = ERR_LOGIN_FAILED; return false; } }
/** * Get and returns all images in the model * @return hash hash of all images * @static */ public static function getAllImages() { $images = ImageModel::selectAll(); return $images; }
public function search($view, $para) { $internalflights_per_page = INTERNALFLIGHTS_PER_PAGE_DEFAULT; $internalflight = "internalflight"; $userLoginBO = json_decode(Session::get("userInfo")); if ($userLoginBO != NULL) { if (isset($userLoginBO->internalflights_per_page) && is_numeric($userLoginBO->internalflights_per_page)) { $internalflights_per_page = (int) $userLoginBO->internalflights_per_page; } } if (!isset($internalflights_per_page)) { if (!isset($_SESSION['options'])) { $_SESSION['options'] = new stdClass(); $_SESSION['options']->internalflights_per_page = INTERNALFLIGHTS_PER_PAGE_DEFAULT; $internalflights_per_page = INTERNALFLIGHTS_PER_PAGE_DEFAULT; } elseif (!isset($_SESSION['options']->internalflights_per_page)) { $_SESSION['options']->internalflights_per_page = INTERNALFLIGHTS_PER_PAGE_DEFAULT; $internalflights_per_page = INTERNALFLIGHTS_PER_PAGE_DEFAULT; } } $view->internalflights_per_page = $internalflights_per_page; $view->internalflight = $internalflight; try { $paraSQL = []; $sqlSelectAll = "SELECT DISTINCT \n cu.`meta_value` AS current_rating,\n vo.`meta_value` AS vote_times,\n im.`meta_value` AS image_id,\n te.`name` AS city_name,\n ta.`term_taxonomy_id` AS city_id,\n ts.`name` AS country_name,\n tc.`term_taxonomy_id` AS country_id,\n po.* "; $sqlSelectCount = "SELECT COUNT(*) as countInternalflight "; //para: orderby, order, page, s, paged, countries, new_role, new_role2, action, action2 $sqlFrom = " FROM\n posts AS po\n LEFT JOIN `postmeta` AS cu ON po.`ID` = cu.`post_id` AND cu.`meta_key` = 'current_rating' \n LEFT JOIN `postmeta` AS vo ON po.`ID` = vo.`post_id` AND vo.`meta_key` = 'vote_times' \n LEFT JOIN `postmeta` AS im ON po.`ID` = im.`post_id` AND im.`meta_key` = 'image_id' \n LEFT JOIN `term_relationships` AS re ON po.`ID` = re.`object_id` \n JOIN `term_taxonomy` AS ta ON re.`term_taxonomy_id` = ta.`term_taxonomy_id` AND ta.`taxonomy` = 'city' \n LEFT JOIN `terms` AS te ON ta.`term_id` = te.`term_id` \n LEFT JOIN `term_relationships` AS rd ON po.`ID` = rd.`object_id` \n JOIN `term_taxonomy` AS tc ON rd.`term_taxonomy_id` = tc.`term_taxonomy_id` AND tc.`taxonomy` = 'country' \n LEFT JOIN `terms` AS ts ON tc.`term_id` = ts.`term_id` "; $sqlWhere = " WHERE po.`post_type` = 'internalflight' "; if (isset($para->s) && strlen(trim($para->s)) > 0) { $sqlWhere .= " AND (\n po.`post_content` LIKE :s \n OR po.`post_name` LIKE :s \n OR po.`post_title` LIKE :s \n OR te.`name` LIKE :s\n OR ts.`name` LIKE :s\n ) "; $paraSQL[':s'] = "%" . $para->s . "%"; $view->s = $para->s; } $view->orderby = "post_title"; $view->order = "asc"; if (isset($para->orderby) && in_array($para->orderby, array("post_title", "city_name", "country_name", "current_rating", "vote_times"))) { switch ($para->orderby) { case "post_title": $para->orderby = "post_title"; $view->orderby = "post_title"; break; case "current_rating": $para->orderby = "current_rating"; $view->orderby = "current_rating"; break; case "vote_times": $para->orderby = "vote_times"; $view->orderby = "vote_times"; break; case "city_name": $para->orderby = "city_name"; $view->orderby = "city_name"; break; case "country_name": $para->orderby = "country_name"; $view->orderby = "country_name"; break; } if (isset($para->order) && in_array($para->order, array("desc", "asc"))) { $view->order = $para->order; } else { $para->order = "asc"; $view->order = "asc"; } $sqlOrderby = " ORDER BY " . $para->orderby . " " . $para->order; } else { $sqlOrderby = " ORDER BY " . TB_POST_COL_POST_TITLE . " ASC"; } $sqlCount = $sqlSelectCount . $sqlFrom . $sqlWhere; $sth = $this->db->prepare($sqlCount); $sth->execute($paraSQL); $countInternalflight = (int) $sth->fetch()->countInternalflight; $view->pageNumber = 0; $view->page = 1; $sqlLimit = ""; if ($countInternalflight > 0) { $view->count = $countInternalflight; $view->pageNumber = floor($view->count / $view->internalflights_per_page); if ($view->count % $view->internalflights_per_page != 0) { $view->pageNumber++; } if (isset($para->page)) { try { $page = (int) $para->page; if ($para->page <= 0) { $page = 1; } } catch (Exception $e) { $page = 1; } } else { $page = 1; } if ($page > $view->pageNumber) { $page = $view->pageNumber; } $view->page = $page; $startInternalflight = ($page - 1) * $view->internalflights_per_page; $sqlLimit = " LIMIT " . $view->internalflights_per_page . " OFFSET " . $startInternalflight; $sqlAll = $sqlSelectAll . $sqlFrom . $sqlWhere . $sqlOrderby . $sqlLimit; $sth = $this->db->prepare($sqlAll); $sth->execute($paraSQL); $count = $sth->rowCount(); if ($count > 0) { $internalflightList = $sth->fetchAll(); for ($i = 0; $i < sizeof($internalflightList); $i++) { $internalflightInfo = $internalflightList[$i]; Model::autoloadModel('image'); $imageModel = new ImageModel($this->db); if (isset($internalflightInfo->image_id)) { $image_object = $imageModel->get($internalflightInfo->image_id); if ($image_object != NULL) { if (isset($image_object->attachment_metadata) && isset($image_object->attachment_metadata->sizes)) { if (isset($image_object->attachment_metadata->sizes->slider_thumb) && isset($image_object->attachment_metadata->sizes->slider_thumb->url)) { $internalflightInfo->image_url = $image_object->attachment_metadata->sizes->slider_thumb->url; } elseif (isset($image_object->attachment_metadata->sizes->thumbnail) && isset($image_object->attachment_metadata->sizes->thumbnail->url)) { $internalflightInfo->image_url = $image_object->attachment_metadata->sizes->thumbnail->url; } elseif (isset($image_object->attachment_metadata->sizes->post_thumbnail) && isset($image_object->attachment_metadata->sizes->post_thumbnail->url)) { $internalflightInfo->image_url = $image_object->attachment_metadata->sizes->post_thumbnail->url; } elseif (isset($image_object->attachment_metadata->sizes->medium) && isset($image_object->attachment_metadata->sizes->medium->url)) { $internalflightInfo->image_url = $image_object->attachment_metadata->sizes->medium->url; } elseif (isset($image_object->attachment_metadata->sizes->medium_large) && isset($image_object->attachment_metadata->sizes->medium_large->url)) { $internalflightInfo->image_url = $image_object->attachment_metadata->sizes->medium_large->url; } elseif (isset($image_object->attachment_metadata->sizes->large) && isset($image_object->attachment_metadata->sizes->large->url)) { $internalflightInfo->image_url = $image_object->attachment_metadata->sizes->large->url; } else { $internalflightInfo->image_url = $image_object->guid; } } else { $internalflightInfo->image_url = $image_object->guid; } } } $this->autoloadBO('internalflight'); $internalflightBO = new InternalflightBO(); $internalflightBO->setInternalflightInfo($internalflightInfo); $internalflightBO->setPost($internalflightInfo); $internalflightList[$i] = $internalflightBO; } $view->internalflightList = $internalflightList; } else { $view->internalflightList = NULL; } } else { $view->internalflightList = NULL; } } catch (Exception $e) { $view->internalflightList = NULL; } }
/** * make thumbnail and resize big image storing them in $dirname (and $dirname/thumb) as $filename * * @param string * @param HttpUploadedFile * @param int * @param int * @param int * @param int * @param bool makeThumbnail for big image or just resize proportionally? * @return void * @throws NotImageException */ public static function savePreviewWithThumb($dirname, $file, $thumb_w, $thumb_h, $big_w, $big_h, $useThumbForBig = false, $filename = 'main.jpg') { // return if no file given [may occur only when editing item otherwise it's controlled when submitting form] if (!$file instanceof HttpUploadedFile or empty($file->name)) { return; } if (!$file->isImage()) { throw new NotImageException('Nahrať možete iba obrázky! Poslaný súbor: ' . $file->name); } $img = $file->toImage(); parent::savePreviewWithThumb($img, $dirname, $thumb_w, $thumb_h, $big_w, $big_h, $useThumbForBig, $filename); }