当前位置: 首页>>代码示例>>PHP>>正文


PHP URL::asset方法代码示例

本文整理汇总了PHP中Illuminate\Support\Facades\URL::asset方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::asset方法的具体用法?PHP URL::asset怎么用?PHP URL::asset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Support\Facades\URL的用法示例。


在下文中一共展示了URL::asset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: imageAvatar

 protected function imageAvatar()
 {
     $path = 'upload/' . date('Ym/d/');
     $filename = KRandom::getRandStr() . '.jpg';
     if (!File::exists(public_path($path))) {
         File::makeDirectory(public_path($path), 493, true);
     }
     while (File::exists(public_path($path) . $filename)) {
         $filename = KRandom::getRandStr() . '.jpg';
     }
     $this->image->resize(new \Imagine\Image\Box(300, 300))->save(public_path($path) . $filename);
     ImageModel::createUploadedImage($path . $filename, URL::asset($path . $filename));
     $user = AuthModel::user();
     $url = URL::asset($path . $filename);
     if ($user) {
         if ($user->profile) {
             $user->profile->avatar = $url;
             $user->profile->save();
         } else {
             ProfileModel::create(array('user_id' => $user->id, 'avatar' => $url));
         }
     } else {
     }
     return $url;
 }
开发者ID:xjtuwangke,项目名称:laravel-cms,代码行数:25,代码来源:UploadifyController.php

示例2: distance

 /**
  * GET DISTANCE BETWEEN LOCATION AND CAFES
  * @param $lat1
  * @param $lon1
  * @param $lat2
  * @param $lon2
  * @param $unit
  * @param $limit
  * @param $id
  * @return array|bool
  */
 public function distance($lat1, $lon1, $lat2, $lon2, $unit, $limit, $id)
 {
     $theta = $lon1 - $lon2;
     $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
     $dist = acos($dist);
     $dist = rad2deg($dist);
     $miles = $dist * 60 * 1.1515;
     $unit = strtoupper($unit);
     //$miles = round($miles);
     $location = $this->cafe->find($id);
     $phone = $location->phone ? '<br/>' . $location->phone : null;
     if (strlen($location->image) < 1) {
         $image = URL::asset('library/img/loc-noimg.jpg');
     } else {
         $image = URL::asset('uploads/store_images/' . $location->image);
     }
     $array = array();
     if ($miles <= $limit) {
         array_push($array, ['image' => $image, 'miles' => intval($miles), 'id' => $location->id, 'name' => $location->name, 'address' => $location->address . '<br/>' . $location->city . ', ' . $location->state . ' ' . $location->zip_code . $phone, 'lat' => $location->lat, 'lng' => $location->lng, 'state' => $location->state, 'country' => $location->country, 'bakery' => $location->bakery, 'icecream' => $location->icecream, 'coffee' => $location->coffee, 'frozenyogurt' => $location->frozenyogurt, 'smoothies' => $location->smoothies, 'wifi' => $location->wifi, 'curbside' => $location->curbside, 'cookie' => $location->cookie, 'savory' => $location->savory, 'map' => $location->maps_url, 'facebook' => $location->facebook_url, 'online_order' => $location->online_order, 'coming_soon' => $location->coming_soon]);
         return $array;
     }
     return false;
     //return $miles;
     //        if ($unit == "K") {
     //            return ($miles * 1.609344);
     //        } else if ($unit == "N") {
     //            return ($miles * 0.8684);
     //        } else {
     //            return round($miles). ' Miles';
     //        }
 }
开发者ID:wearecolossal,项目名称:nestlecafe,代码行数:42,代码来源:LocationController.php

示例3: getDrawResult

 public function getDrawResult()
 {
     $userId = $this->getRandomUserId();
     $user = $this->getUser($userId);
     $user['profileImage'] = URL::asset('uploads/' . $user->image);
     $response = array('status' => true, 'user' => $user);
     return Response::json($response);
 }
开发者ID:riasat97,项目名称:kailine,代码行数:8,代码来源:RaffleDrawsController.php

示例4: asset

 public static function asset($uri)
 {
     if (preg_match('/^http|https\\:\\/\\/.*/i', $uri)) {
         return $uri;
     } else {
         $version = static::$version ? static::$version . '/' : '';
         return URL::asset("packages/xjtuwangke/laravel-cms/{$version}{$uri}");
     }
 }
开发者ID:xjtuwangke,项目名称:laravel-cms,代码行数:9,代码来源:KUrl.php

示例5: getImageUrl

 public function getImageUrl($withBaseUrl = false)
 {
     if (!$this->icon) {
         return NULL;
     }
     $imgDir = '/images/languages/' . $this->id;
     $url = $imgDir . '/' . $this->icon;
     return $withBaseUrl ? URL::asset($url) : $url;
 }
开发者ID:allienz123,项目名称:Madam_LA_PID,代码行数:9,代码来源:Language.php

示例6: staticAsset

 /**
  * Generate URL from static CDN if STATIC_CDN_PATH is defined
  *
  * @param $path
  * @param bool|null $secure
  * @return string
  */
 function staticAsset($path, $secure = null)
 {
     if ($secure == null) {
         $secure = env('STATIC_CDN_SECURE', null);
     }
     if ($staticPath = env('STATIC_CDN_PATH', false)) {
         return URL::assetFrom($staticPath, $path, $secure);
     }
     return URL::asset($path, $secure);
 }
开发者ID:SaschaDens,项目名称:saschadens.be,代码行数:17,代码来源:helpers.php

示例7: getListMultiple

 private function getListMultiple($row)
 {
     if (!$this->getValue($row)) {
         return '';
     }
     $images = json_decode($this->getValue($row), true);
     // FIXME: fix fixfix
     $html = '<div style="cursor:pointer;height: 50px;overflow: hidden;" onclick="$(this).css(\'height\', \'auto\').css(\'overflow\', \'auto\');">';
     foreach ($images as $source) {
         $src = $this->getAttribute('before_link') . $source['sizes']['original'] . $this->getAttribute('after_link');
         // FIXME: move to template
         $src = $this->getAttribute('is_remote') ? $src : URL::asset($src);
         $html .= '<img height="' . $this->getAttribute('img_height', '50px') . '" src="' . $src . '" /><br>';
     }
     $html .= '</div>';
     return $html;
 }
开发者ID:arturishe21,项目名称:buider,代码行数:17,代码来源:ImageField.php

示例8: editWorkstreamRiskOrIssue

 public function editWorkstreamRiskOrIssue($programid, $workstreamid, $riskid)
 {
     $program = Program::findOrFail($programid);
     $workstream = WorkStream::findOrFail($workstreamid);
     $risk = Risk::findorFail($riskid);
     //return "Owner id: $risk->owner , Owner Name: $risk->OwnerName";
     $title = "Edit {$risk->title} for the {$workstream->name} Workstream";
     $breadcrumbs[] = ['Home', URL::asset('/home'), false];
     $breadcrumbs[] = ['Programs', URL::asset('programs'), false];
     $breadcrumbs[] = [$program->name, URL::asset('/') . "/programs/{$programid}", false];
     $breadcrumbs[] = ['Workstreams', '', false];
     $breadcrumbs[] = [$workstream->name, URL::asset('/') . "/programs/{$programid}/workstreams/{$workstreamid}", false];
     $breadcrumbs[] = ['Risks & Issues', '', false];
     $breadcrumbs[] = [$risk->title, '', false];
     $breadcrumbs[] = ['Edit', URL::asset('/') . "/programs/{$programid}/workstreams/{$workstreamid}/risksandissues/{$riskid}/edit", true];
     $redirect = "/programs/{$programid}/workstreams/{$workstreamid}";
     //return $risk->NextReviewDate;
     return $this->edit($risk, $title, $breadcrumbs, $redirect);
 }
开发者ID:SlipperyPenguine,项目名称:tracker,代码行数:19,代码来源:RiskAndIssueController.php

示例9: getBreadCrumb

 public static function getBreadCrumb($subjecttype, $subjectid)
 {
     $breadcrumbs[] = ['Home', URL::asset('/home'), false];
     switch ($subjecttype) {
         case "Program":
             $program = Program::findOrFail($subjectid);
             $programid = $program->id;
             $breadcrumbs[] = ['Programs', URL::asset('programs'), false];
             $breadcrumbs[] = [$program->name, URL::asset('/') . "/programs/{$programid}", false];
             return $breadcrumbs;
             break;
         case "WorkStream":
             $workstream = WorkStream::findOrFail($subjectid);
             $program = Program::findOrFail($workstream->program_id);
             $programid = $program->id;
             $workstreamid = $workstream->id;
             $breadcrumbs[] = ['Programs', URL::asset('programs'), false];
             $breadcrumbs[] = [$program->name, URL::asset('/') . "/programs/{$programid}", false];
             $breadcrumbs[] = ['Workstreams', '', false];
             $breadcrumbs[] = [$workstream->name, URL::asset('/') . "/programs/{$programid}/workstreams/{$workstreamid}", false];
             return $breadcrumbs;
             break;
         case "Project":
             $project = Project::findOrFail($subjectid);
             $workstream = WorkStream::findOrFail($project->work_stream_id);
             $program = Program::findOrFail($workstream->program_id);
             $programid = $program->id;
             $workstreamid = $workstream->id;
             $breadcrumbs[] = ['Programs', URL::asset('programs'), false];
             $breadcrumbs[] = [$program->name, URL::asset('/') . "/programs/{$programid}", false];
             $breadcrumbs[] = ['Workstreams', '', false];
             $breadcrumbs[] = [$workstream->name, URL::asset('/') . "/programs/{$programid}/workstreams/{$workstreamid}", false];
             $breadcrumbs[] = ['Projects', '', false];
             $breadcrumbs[] = [$project->name, URL::asset('/') . "/programs/{$programid}/workstreams/{$workstreamid}/projects/{$project->id}", false];
             return $breadcrumbs;
             break;
         case "Risk":
             $risk = Risk::findOrFail($subjectid);
             $breadcrumbs = Breadcrumbs::getBreadCrumb($risk->subject_type, $risk->subject_id);
             $breadcrumbs[] = ['Risks', '', false];
             $breadcrumbs[] = [$risk->title, URL::asset('risks/') . "/{$risk->id}", false];
             return $breadcrumbs;
             break;
         case "Action":
             $action = Action::findOrFail($subjectid);
             $breadcrumbs = Breadcrumbs::getBreadCrumb($action->subject_type, $action->subject_id);
             $breadcrumbs[] = ['Actions', URL::action('ActionController@index', [$action->subject_type, $action->subject_id]), false];
             $breadcrumbs[] = [$action->title, '', false];
             return $breadcrumbs;
             break;
         case "Rag":
             $rag = rag::findOrFail($subjectid);
             $breadcrumbs = Breadcrumbs::getBreadCrumb($rag->subject_type, $rag->subject_id);
             $breadcrumbs[] = ['RAGs', URL::action('RagController@index', [$rag->subject_type, $rag->subject_id]), false];
             $breadcrumbs[] = [$rag->title, '', false];
             return $breadcrumbs;
             break;
         case "Task":
             $task = Task::findOrFail($subjectid);
             $breadcrumbs = Breadcrumbs::getBreadCrumb($task->subject_type, $task->subject_id);
             $breadcrumbs[] = ['Tasks', URL::action('TaskController@indexTask', [$task->subject_type, $task->subject_id]), false];
             $breadcrumbs[] = [$task->title, URL::asset('tasks/') . "/{$task->id}", false];
             return $breadcrumbs;
             break;
         case "Dependency":
             $dependency = Dependency::findOrFail($subjectid);
             $breadcrumbs = Breadcrumbs::getBreadCrumb($dependency->subject_type, $dependency->subject_id);
             $breadcrumbs[] = ['Dependencies', URL::action('DependencyController@index', [$dependency->subject_type, $dependency->subject_id]), false];
             $breadcrumbs[] = [$dependency->title, URL::asset('dependencies/') . "/{$dependency->id}", false];
             return $breadcrumbs;
             break;
         case "ChangeRequest":
             $changerequest = ChangeRequest::findOrFail($subjectid);
             $breadcrumbs = Breadcrumbs::getBreadCrumb($changerequest->subject_type, $changerequest->subject_id);
             $breadcrumbs[] = ['Change Requests', URL::action('ChangeRequestController@index', [$changerequest->subject_type, $changerequest->subject_id]), false];
             $breadcrumbs[] = [$changerequest->title, URL::asset('changerequests/') . "/{$changerequest->id}", false];
             return $breadcrumbs;
             break;
         case "Link":
             $link = Link::findOrFail($subjectid);
             $breadcrumbs = Breadcrumbs::getBreadCrumb($link->subject_type, $link->subject_id);
             $breadcrumbs[] = ['Links', URL::action('LinkController@index', [$link->subject_type, $link->subject_id]), false];
             $breadcrumbs[] = [$link->title, URL::asset('links/') . "/{$link->id}", false];
             return $breadcrumbs;
             break;
     }
 }
开发者ID:SlipperyPenguine,项目名称:tracker,代码行数:87,代码来源:Breadcrumbs.php

示例10: thumbUrl

 /**
  * Return the item url
  *
  * @return string
  */
 public function thumbUrl()
 {
     $resourceUrl = $this->thumb();
     return URL::asset($resourceUrl);
 }
开发者ID:spescina,项目名称:mediabrowser,代码行数:10,代码来源:Item.php

示例11: SaveSendEmailDoctorConfirm

 /**
  * save & send email confirm doctor details
  * @param Request $request
  * @return \Illuminate\Http\JsonResponse
  */
 public function SaveSendEmailDoctorConfirm(Request $request)
 {
     try {
         $doctor_id = $request->doctor_id;
         $user_id = $request->user_id;
         $username = $request->username;
         $password = $request->password;
         /* Select patient record from table*/
         $re_patient = User::find($user_id);
         $re_patient->email = $username;
         $re_patient->password = md5($password);
         $re_patient->save();
         $doctor = Doctors::whereId($doctor_id)->first();
         $url = URL::asset('') . "DoctorAccount";
         $subject['sub'] = "Account Activated at eAyurveda.lk";
         $subject['email'] = $doctor->email;
         $subject['name'] = $doctor->first_name . ' ' . $doctor->last_name;
         Mail::send('emails.doctor_login_mail', ['name' => $subject['name'], 'url' => $url, 'username' => $username, 'password' => $password], function ($message) use($subject) {
             $message->to($subject['email'], $subject['name'])->subject($subject['sub']);
         });
         $res['CHECK'] = "Changed";
     } catch (Exception $e) {
         $res['CHECK'] = "Fail";
         $this->LogError('Admin_Front SaveDoctorConfirm Function', $e);
     }
     return response()->json($res);
 }
开发者ID:Bmax-Tech,项目名称:SEP-Prototype_MVC,代码行数:32,代码来源:Admin_Front.php

示例12: doUpload

 public function doUpload($file)
 {
     $extension = $file->guessExtension();
     $rawFileName = md5_file($file->getRealPath()) . '_' . time();
     $fileName = $rawFileName . '.' . $extension;
     $definitionName = $this->getOption('def_name');
     $prefixPath = 'storage/tb-' . $definitionName . '/';
     // FIXME: generate path by hash
     $postfixPath = date('Y') . '/' . date('m') . '/' . date('d') . '/';
     $destinationPath = $prefixPath . $postfixPath;
     $status = $file->move($destinationPath, $fileName);
     $data = array();
     $data['sizes']['original'] = $destinationPath . $fileName;
     $variations = $this->getAttribute('variations', array());
     foreach ($variations as $type => $methods) {
         $img = Image::make($data['sizes']['original']);
         foreach ($methods as $method => $args) {
             call_user_func_array(array($img, $method), $args);
         }
         $path = $destinationPath . $rawFileName . '_' . $type . '.' . $extension;
         $quality = $this->getAttribute('quality', 100);
         $img->save(public_path() . '/' . $path, $quality);
         $data['sizes'][$type] = $path;
     }
     $response = array('data' => $data, 'status' => $status, 'link' => URL::asset($destinationPath . $fileName), 'short_link' => $destinationPath . $fileName, 'delimiter' => ',');
     return $response;
 }
开发者ID:OlesKashchenko,项目名称:Jarboe,代码行数:27,代码来源:ImageField.php

示例13: uploadFiles

 public function uploadFiles($idPaciente, $img_profile)
 {
     $fileSystem = new Filesystem();
     $countProfileImg = count($img_profile);
     //creo la extructura de carpetas para el doctor
     //for profile_img
     if (!empty($img_profile)) {
         $destinationPath = public_path() . "/upload/hospitales/FACHADASG/FACHADASCH/";
         $file = str_replace('data:image/png;base64,', '', $img_profile);
         $img = str_replace(' ', '+', $file);
         $data = base64_decode($img);
         $filename = date('ymdhis') . '_croppedImage' . ".png";
         $file = $destinationPath . $filename;
         $success = file_put_contents($file, $data);
         // THEN RESIZE IT
         $returnData = "upload/hospitales/FACHADASG/FACHADASCH/" . $filename;
         $image = Image::make(file_get_contents(URL::asset($returnData)));
         $image = $image->resize(300, 300)->save($destinationPath . $filename);
         if (!$success) {
             return false;
         }
     } else {
         $filename = "";
     }
     /*if($countProfileImg > 0){
           if($fileSystem->exists("upload/pacientes/$idPaciente/profile_img/")){
               $name=date('Ymdhis').'.'.$img_profile->getClientOriginalExtension();
               if(!$img_profile->move("upload/pacientes/$idPaciente/profile_img",$name)){
                   return false;
               }
           }
       }else{
           $name="";
       }*/
     return array('img_profile_name' => $filename);
 }
开发者ID:rldiezn,项目名称:platzy,代码行数:36,代码来源:hospitalModel.php

示例14: uploadFiles

 public function uploadFiles($idServicio, $img_profile)
 {
     $fileSystem = new Filesystem();
     $countProfileImg = count($img_profile);
     //creo la extructura de carpetas para el doctor
     //for profile_img
     if (!empty($img_profile)) {
         $destinationPath = public_path() . "/upload/servicio/";
         $file = str_replace('data:image/png;base64,', '', $img_profile);
         $img = str_replace(' ', '+', $file);
         $data = base64_decode($img);
         $filename = date('ymdhis') . '_croppedImage' . ".png";
         $file = $destinationPath . $filename;
         $success = file_put_contents($file, $data);
         // THEN RESIZE IT
         $returnData = "upload/servicio/" . $filename;
         $image = Image::make(file_get_contents(URL::asset($returnData)));
         $image = $image->resize(300, 300)->save($destinationPath . $filename);
         if (!$success) {
             return false;
         }
     } else {
         $filename = "";
     }
     return array('img_profile_name' => $filename);
 }
开发者ID:rldiezn,项目名称:platzy,代码行数:26,代码来源:servicioModel.php

示例15: getPicture

 /**
  * Get the picture for the user.
  *
  * @param  boolean  $thumbnail
  * @return string
  */
 public function getPicture($thumbnail = false)
 {
     $picture = URL::asset('assets/images/display-pic-default.png');
     if (!$thumbnail) {
         $file = config('auth.path_picture') . config('auth.filename_picture');
     } else {
         $file = config('auth.path_picture_thumbnail') . config('auth.filename_picture_thumbnail');
     }
     $file = str_replace(':userId', $this->id, $file);
     if (is_file($file)) {
         $picture = URL::to($file);
     }
     return $picture;
 }
开发者ID:GDanielRG,项目名称:Identify,代码行数:20,代码来源:User.php


注:本文中的Illuminate\Support\Facades\URL::asset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。