本文整理汇总了PHP中SiteHelpers::resizewidth方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteHelpers::resizewidth方法的具体用法?PHP SiteHelpers::resizewidth怎么用?PHP SiteHelpers::resizewidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteHelpers
的用法示例。
在下文中一共展示了SiteHelpers::resizewidth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postSave
function postSave($id = 0)
{
$trackUri = $this->data['trackUri'];
//$rules = $this->validateForm();
$rules = Slideshow::$rules;
$validator = Validator::make(Input::all(), $rules);
if ($validator->passes()) {
$data = $this->getDataPost('slideshow');
if (!is_null(Input::file('file'))) {
$file = Input::file('file');
$destinationPath = './uploads/slideshow/';
$filename = $file->getClientOriginalName();
$extension = $file->getClientOriginalExtension();
//if you need extension of the file
$newfilename = SiteHelpers::seoUrl(trim(Input::get('slideshow_name'))) . '_' . time() . '.' . $extension;
$uploadSuccess = Input::file('file')->move($destinationPath, $newfilename);
if ($uploadSuccess) {
$data['slideshow_image'] = $newfilename;
$orgFile = $destinationPath . '/' . $newfilename;
$thumbFile = $destinationPath . '/thumb/' . $newfilename;
SiteHelpers::resizewidth("1140", $orgFile, $thumbFile);
if (Input::get('slideshow_id') != "") {
$data_old = $this->model->getRow(Input::get('slideshow_id'));
@unlink(ROOT . '/uploads/slideshow/' . $data_old->slideshow_image);
@unlink(ROOT . '/uploads/slideshow/thumb/' . $data_old->slideshow_image);
}
}
}
$data['slideshow_alias'] = SiteHelpers::seoUrl(trim($data['slideshow_name']));
$data['created'] = time();
$ID = $this->model->insertRow($data, Input::get('slideshow_id'));
// Input logs
if (Input::get('slideshow_id') == '') {
$this->inputLogs("New Entry row with ID : {$ID} , Has Been Save Successfull");
$id = SiteHelpers::encryptID($ID);
} else {
$this->inputLogs(" ID : {$ID} , Has Been Changed Successfull");
}
// Redirect after save
$md = str_replace(" ", "+", Input::get('md'));
$redirect = !is_null(Input::get('apply')) ? 'Slideshow/add/' . $id . '?md=' : 'Slideshow?md=';
return Redirect::to($redirect)->with('message', SiteHelpers::alert('success', Lang::get('core.note_success')));
} else {
return Redirect::to('Slideshow/add/' . $id . '?md=')->with('message', SiteHelpers::alert('error', Lang::get('core.note_error')))->withErrors($validator)->withInput();
}
}
示例2: postSave
function postSave($id = 0)
{
$trackUri = $this->data['trackUri'];
$rules = Nproducts::$rules;
//print_r(Input::all());die;
$validator = Validator::make(Input::all(), $rules);
//SiteHelpers::globalXssClean();
if ($validator->passes()) {
$data = $this->getDataPost('products');
if (!is_null(Input::file('file'))) {
$file = Input::file('file');
$destinationPath = './uploads/products/';
$filename = $file->getClientOriginalName();
$extension = $file->getClientOriginalExtension();
//if you need extension of the file
$newfilename = Input::get('ProductName') . '_' . time() . '.' . $extension;
$uploadSuccess = Input::file('file')->move($destinationPath, $newfilename);
if ($uploadSuccess) {
$data['image'] = $newfilename;
$orgFile = $destinationPath . '/' . $newfilename;
$thumbFile = $destinationPath . '/thumb/' . $newfilename;
SiteHelpers::resizewidth("152", $orgFile, $thumbFile);
if (Input::get('action') != "") {
$data_old = $this->model->getRow(Input::get('action'));
@unlink(ROOT . '/uploads/products/' . $data_old->Picture);
@unlink(ROOT . '/uploads/products/thumb/' . $data_old->Picture);
}
}
}
$data['SupplierID'] = "1";
$data['created'] = time();
$data['slug'] = SiteHelpers::seoUrl(trim($data['ProductName']));
$data['created'] = time();
$ID = $this->model->insertRow($data, Input::get('ProductID'));
if (Input::file('multi_file')[0] != "") {
$model_img_pro = new Imagesproduct();
$rm_image = Input::get('remove_image');
$arr_img_rm = $rm_image != "" ? $rm_image : array();
foreach ($_FILES['multi_file']['tmp_name'] as $key => $tmp_name) {
$file_name = $_FILES['multi_file']['name'][$key];
if (!in_array($file_name, $arr_img_rm)) {
$file_size = $_FILES['multi_file']['size'][$key];
$file_tmp = $_FILES['multi_file']['tmp_name'][$key];
$file_type = $_FILES['multi_file']['type'][$key];
$explode_name = explode(".", $file_name);
$path_image = './uploads/images_product/';
$newname = "image_" . $key . time() . '.' . $explode_name[1];
if (move_uploaded_file($file_tmp, $path_image . $newname)) {
$model_img_pro->insertRow(array("name" => $newname, "id_product" => $ID), "");
SiteHelpers::resizewidth("300", $path_image . $newname, $path_image . "thumb/" . $newname);
}
}
}
}
// Input logs
if (Input::get('ProductID') == '') {
$this->inputLogs("New Entry row with ID : {$ID} , Has Been Save Successfull");
$id = SiteHelpers::encryptID($ID);
} else {
$this->inputLogs(" ID : {$ID} , Has Been Changed Successfull");
}
// Redirect after save
$md = str_replace(" ", "+", Input::get('md'));
$redirect = !is_null(Input::get('apply')) ? 'Nproducts/add/' . $id . $trackUri : 'Nproducts' . $trackUri;
return Redirect::to($redirect)->with('message', SiteHelpers::alert('success', Lang::get('core.note_success')));
} else {
return Redirect::to('Nproducts/add/' . $id)->with('message', SiteHelpers::alert('error', Lang::get('core.note_error')))->withErrors($validator)->withInput();
}
}
示例3: postSave
function postSave($id = 0)
{
$trackUri = $this->data['trackUri'];
//$rules = $this->validateForm();
$validator = Validator::make(Input::all(), Ncategories::$rules);
SiteHelpers::globalXssClean();
if ($validator->passes()) {
if (!is_null(Input::file('file'))) {
$file = Input::file('file');
$destinationPath = ROOT . '/uploads/categories/';
$filename = $file->getClientOriginalName();
$extension = $file->getClientOriginalExtension();
//if you need extension of the file
$newfilename = Input::get('CategoryName') . '_' . time() . '.' . $extension;
$uploadSuccess = Input::file('file')->move($destinationPath, $newfilename);
if ($uploadSuccess) {
$data['Picture'] = $newfilename;
$orgFile = $destinationPath . '/' . $newfilename;
$thumbFile = $destinationPath . '/thumb/' . $newfilename;
//SiteHelpers::cropImage($this->img_width , $this->img_height , $orgFile , $extension, $thumbFile);
SiteHelpers::resizewidth("180", $orgFile, $thumbFile);
if (Input::get('action') != "") {
$data_old = $this->model->getRow(Input::get('action'));
@unlink(ROOT . '/uploads/categories/' . $data_old->Picture);
@unlink(ROOT . '/uploads/categories/thumb/' . $data_old->Picture);
}
}
}
$data['postion'] = Input::get('postion');
$data['CategoryName'] = Input::get('CategoryName');
$data['Description'] = Input::get('Description');
$data['lang'] = $this->lang;
$data['created'] = time();
$data['status'] = Input::get('status');
$data['alias'] = SiteHelpers::seoUrl(trim($data['CategoryName']));
$data['keywords'] = Input::get('keywords');
$data['seo_meta'] = Input::get('seo_meta');
//$data = $this->validatePost('categories');
$ID = $this->model->insertRow($data, Input::get('CategoryID'));
// Input logs
if (Input::get('CategoryID') == '') {
$this->inputLogs("New Entry row with ID : {$ID} , Has Been Save Successfull");
$id = SiteHelpers::encryptID($ID);
} else {
$this->inputLogs(" ID : {$ID} , Has Been Changed Successfull");
}
// Redirect after save
//$md = str_replace(" ","+",Input::get('md'));
$redirect = !is_null(Input::get('apply')) ? 'Ncategories/add/' . $id : 'Ncategories?md=';
return Redirect::to($redirect)->with('message', SiteHelpers::alert('success', Lang::get('core.note_success')));
} else {
return Redirect::to('Ncategories/add/' . $id)->with('message', SiteHelpers::alert('error', Lang::get('core.note_error')))->withErrors($validator)->withInput();
}
}
示例4: postChangeinfo
public function postChangeinfo()
{
if (!Session::has('customer')) {
return Redirect::to('dang-ky.html');
}
$rules = $rules = array('name' => '', 'phone' => '', 'link_website' => '', 'link_fanpage' => '');
if (CNF_RECAPTCHA == 'true') {
$rules['recaptcha_response_field'] = 'required|recaptcha';
}
$validator = Validator::make(Input::all(), $rules);
if ($validator->passes()) {
$ses_cus = Session::get('customer');
$data['name'] = Input::get('name');
$data['phone'] = Input::get('phone');
//$data['address'] = Input::get('address');
$data['cmnd'] = Input::get('cmnd');
$data['link_website'] = Input::get('link_website');
$data['link_fanpage'] = Input::get('link_fanpage');
if (!is_null(Input::file('file'))) {
$file = Input::file('file');
$destinationPath = './uploads/customer/';
$filename = $file->getClientOriginalName();
$extension = $file->getClientOriginalExtension();
//if you need extension of the file
$newfilename = time() . '.' . $extension;
$uploadSuccess = Input::file('file')->move($destinationPath, $newfilename);
if ($uploadSuccess) {
$data['image'] = $newfilename;
$orgFile = $destinationPath . '/' . $newfilename;
$thumbFile = $destinationPath . '/thumb/' . $newfilename;
SiteHelpers::resizewidth("193", $orgFile, $thumbFile);
if ($ses_cus['image'] != '') {
@unlink(ROOT . '/uploads/customer/' . $ses_cus['image']);
@unlink(ROOT . '/uploads/customer/thumb/' . $ses_cus['image']);
}
}
}
DB::table('customer')->where('email', '=', $ses_cus['email'])->where('username', '=', $ses_cus['username'])->update($data);
return Redirect::to('thong-bao.html')->with('message', SiteHelpers::alert('success', 'Thay đổi thông tin thành công !'));
} else {
return Redirect::to('thong-tin-thanh-vien.html')->with('message_changeinfo', SiteHelpers::alert('error', 'Vui lòng xác nhận các thông tin bên dưới'))->withErrors($validator)->withInput();
}
}