本文整理汇总了PHP中public_path函数的典型用法代码示例。如果您正苦于以下问题:PHP public_path函数的具体用法?PHP public_path怎么用?PHP public_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了public_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filterLoad
/**
* Filters an asset after it has been loaded.
*
* @param \Assetic\Asset\AssetInterface $asset
* @return void
*/
public function filterLoad(AssetInterface $asset)
{
$max_nesting_level = ini_get('xdebug.max_nesting_level');
$memory_limit = ini_get('memory_limit');
if ($max_nesting_level && $max_nesting_level < 200) {
ini_set('xdebug.max_nesting_level', 200);
}
if ($memory_limit && $memory_limit < 256) {
ini_set('memory_limit', '256M');
}
$root = $asset->getSourceRoot();
$path = $asset->getSourcePath();
$dirs = array();
$lc = new \Less_Parser(array('compress' => true));
if ($root && $path) {
$dirs[] = dirname($root . '/' . $path);
}
foreach ($this->loadPaths as $loadPath) {
$dirs[] = $loadPath;
}
$lc->SetImportDirs($dirs);
$url = parse_url($this->getRequest()->getUriForPath(''));
$absolutePath = str_replace(public_path(), '', $root);
if (isset($url['path'])) {
$absolutePath = $url['path'] . $absolutePath;
}
$lc->parseFile($root . '/' . $path, $absolutePath);
$asset->setContent($lc->getCss());
}
示例2: getUploadTo
/**
* Get where the file is to be uploaded to
*
* @return mixed
*/
public function getUploadTo($path = '')
{
if (isset($this->options['upload_to'])) {
return $this->options['upload_to'];
}
return public_path($this->addSlashes(self::DEFAULT_UPLOAD_TO)) . $path;
}
示例3: editUser
public function editUser($id, Request $request)
{
$user = User::find($id);
if ($request->has('first')) {
$user->first = $request->input('first');
}
if ($request->has('last')) {
$user->last = $request->input('last');
}
if ($request->has('email')) {
$user->email = $request->input('email');
}
if ($request->has('phone')) {
$user->phone = $request->input('phone');
}
if ($request->hasFile('resume')) {
$request->file('resume')->move(public_path('resumes'), $user->first . '-' . $user->last . '-' . $user->id . '.jpg');
$user->resume = '/resumes/' . $user->first . '-' . $user->last . '-' . $user->id . '.jpg';
}
if ($request->hasFile('headshot')) {
$request->file('headshot')->move(public_path('headshots'), $user->first . '-' . $user->last . '-' . $user->id . '.jpg');
$user->headshot = '/headshots/' . $user->first . '-' . $user->last . '-' . $user->id . '.jpg';
}
if ($request->has('user_type')) {
$user->user_type = $request->input('user_type');
}
$request->session()->flash('success', 'User Updated!');
$user->save();
return view('admin.user-edit', ['user' => $user]);
}
示例4: run
public function run()
{
DB::table('home_page')->delete();
$success = File::cleanDirectory($this->getImagesPath());
File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore'));
HomePage::create(['headline' => "Industrial Legacy", 'text' => 'RUSTIC DETAILS. MODERN EDGE. REFINED LIVING IN COURT SQUARE. <br> 1 - 4 BEDROOM HOMES FROM $615K. PENTHOUSES PRICED UPON REQUEST.', 'subtext' => 'CHILDREN\'S PLAYROOM, LOUNGE, LIBRARY, GYM, TERRACE AND PARKING', 'image' => $this->copyImage(public_path() . '/backup_images/building/building.jpg')]);
}
示例5: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$this->publishes([__DIR__ . '/../assets/ajaxblade.js' => public_path('vendor/ajaxblade/ajaxblade.js')], 'public');
Blade::directive('ajaxpagination', function ($expression) {
return "<?php echo with({$expression})->render() ?>\n <script>\n \$(document).ready(function(){\n \$('ul.pagination:visible:first').hide();\n \$('div.abs').jscroll({\n debug: true,\n autoTrigger: true,\n nextSelector: '.pagination li.active + li a',\n contentSelector: 'div.abs',\n callback: function() {\n \$('ul.pagination:visible:first').hide();\n }\n });\n });\n </script>\n ";
});
}
示例6: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
if (Auth::check()) {
# code...
if (Auth::user()->type == 1) {
# code...
$rules = ['activity_id' => 'required|integer', 'event_name' => 'required|unique:events', 'image_path' => 'required|image'];
$validator = Validator::make($request->all(), $rules);
if ($validator->fails()) {
# code...
return redirect()->back()->withErrors($validator);
}
if ($request->hasFile('image_path')) {
$input = $request->all();
$image = $input['image_path'];
$name = '' . $input['event_name'] . '.png';
//dd($name);
$image = $image->move(public_path() . '/images/events/', studly_case($name));
$url = '/images/events/' . studly_case($name);
$event = Event::create(['activity_id' => $input['activity_id'], 'event_name' => $input['event_name'], 'image_path' => $url]);
if ($event) {
# code...
$subscribedUsers = $this->getUsers($event->activity_id);
$this->sendEmail($subscribedUsers, $event->event_name);
Session::flash('eventCreated', $event->event_name . ' has been created!');
} else {
return "error creating the event.";
}
return redirect('home');
}
return redirect('/');
}
}
return redirect('/');
}
示例7: updateWelcomeMessage
public function updateWelcomeMessage()
{
$user = User::find(Auth::user()->id);
$data = array('welcome_message' => Input::get('welcome_message'), 'welcome_phone_number' => Input::get('welcome_phone_number'));
$customRule['welcome_message'] = 'required';
$customRule['welcome_phone_number'] = 'required';
$messages = array('required' => 'Harap mengisi informasi :attribute.', 'image' => 'Tipe file gambar yang Anda berikan salah, mohon mencoba kembali.');
$validator = Validator::make($data, $customRule, $messages);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
if (Input::hasFile('welcome_photo')) {
// checking file is valid.
if (Input::file('welcome_photo')->isValid()) {
$destinationPath = '/uploads/anggota';
// upload path
$extension = Input::file('welcome_photo')->getClientOriginalExtension();
// getting image extension
$fileName = $user->id . '.' . $extension;
// rename image
Input::file('welcome_photo')->move(public_path() . $destinationPath, $fileName);
// uploading file to given path
$data['welcome_photo'] = $destinationPath . "/" . $fileName;
} else {
// sending back with error message.
return Redirect::back()->with('errors', 'Uploaded file is not valid')->withInput();
}
}
$user->update($data);
return Redirect::route('member.dashboard')->with("message", "Data berhasil disimpan");
}
示例8: store
public function store(PostRequest $request)
{
if (Input::has('link')) {
$input['link'] = Input::get('link');
$info = Embed::create($input['link']);
if ($info->image == null) {
$embed_data = ['text' => $info->description];
} else {
if ($info->description == null) {
$embed_data = ['text' => ''];
} else {
$orig = pathinfo($info->image, PATHINFO_EXTENSION);
$qmark = str_contains($orig, '?');
if ($qmark == false) {
$extension = $orig;
} else {
$extension = substr($orig, 0, strpos($orig, '?'));
}
$newName = public_path() . '/images/' . str_random(8) . ".{$extension}";
if (File::exists($newName)) {
$imageToken = substr(sha1(mt_rand()), 0, 5);
$newName = public_path() . '/images/' . str_random(8) . '-' . $imageToken . ".{$extension}";
}
$image = Image::make($info->image)->fit(70, 70)->save($newName);
$embed_data = ['text' => $info->description, 'image' => basename($newName)];
}
}
Auth::user()->posts()->create(array_merge($request->all(), $embed_data));
return redirect('/subreddit');
}
Auth::user()->posts()->create($request->all());
return redirect('/subreddit');
}
示例9: __construct
public function __construct()
{
$this->script_url = URL('file/photos/delete_image');
$this->upload_dir = public_path() . '/uploads/images/';
$this->upload_url = URL('/') . '/uploads/images/';
$this->fileName = 'files';
}
示例10: procesarImagenModelo
protected function procesarImagenModelo($imagen)
{
$filename = date('Y-m-d-H:i:s') . "-" . $imagen->getClientOriginalName();
$pathCompleto = $this->imagePath . $filename;
Image::make($imagen->getRealPath())->resize($this->_imageSize['width'], $this->_imageSize['height'])->save(public_path($pathCompleto));
return $pathCompleto;
}
示例11: register
/**
* @inherit
*/
public function register()
{
// Enable "@include("sledgehammer:statusbar") in blade
$this->loadViewsFrom(dirname(__DIR__) . '/views', 'sledgehammer');
// Register the public assets for `php artisan vendor:publish`
$this->publishes([dirname(__DIR__) . '/public' => public_path('sledgehammer'), dirname(dirname(__DIR__)) . '/core/public' => public_path('sledgehammer/core')], 'public');
}
示例12: generate
/**
* Return captcha image
* @param number $maxChar
*/
public function generate($maxChar = 4)
{
// $characters = '23456789abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ';
$characters = 'ABCDEFGHKMNPQRST';
$captchaText = '';
for ($i = 0; $i < $maxChar; $i++) {
$captchaText .= $characters[rand(0, strlen($characters) - 1)];
}
strtoupper(substr(md5(microtime()), 0, 7));
\Session::put('captchaHash', \Hash::make($captchaText));
$image = imagecreate(30 * $maxChar, 35);
$background = imagecolorallocatealpha($image, 255, 255, 255, 1);
$textColor = imagecolorallocatealpha($image, 206, 33, 39, 1);
$x = 5;
$y = 20;
$angle = 0;
for ($i = 0; $i < 7; $i++) {
$fontSize = 16;
$text = substr($captchaText, $i, 1);
imagettftext($image, $fontSize, $angle, $x, $y, $textColor, public_path('/fonts/LibreBaskerville/librebaskerville-regular.ttf'), $text);
$x = $x + 17 + mt_rand(1, 10);
$y = mt_rand(18, 25);
$angle = mt_rand(0, 20);
}
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Pragma: no-cache');
header('Content-type: image/jpeg');
imagejpeg($image, null, 100);
imagedestroy($image);
}
示例13: deleteManifest
/**
* Delete Manifest file(s) in the application's assets path
*
* @return void
*/
protected function deleteManifest()
{
$manifests = find_paths(public_path('assets/') . 'manifest-*.json');
foreach ($manifests as $manifest) {
File::delete($manifest);
}
}
示例14: boot
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot()
{
$this->publishes([__DIR__ . '/../../resources/assets' => public_path('vendor/jplatform')], 'public');
app('Dingo\\Api\\Auth\\Auth')->extend('inSession', function ($app) {
return app('jarvis.auth.provider');
});
}
示例15: postIndex
/**
* Validates and stores the user's update data.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v1.0]
* @return Redirect
*/
public function postIndex()
{
// Grab the user
$user = Auth::user();
// Update the user information
$user->first_name = e(Input::get('first_name'));
$user->last_name = e(Input::get('last_name'));
$user->website = e(Input::get('website'));
$user->location_id = e(Input::get('location_id'));
$user->gravatar = e(Input::get('gravatar'));
$user->locale = e(Input::get('locale'));
if (Input::file('avatar')) {
$image = Input::file('avatar');
$file_name = $user->first_name . "-" . $user->last_name . "." . $image->getClientOriginalExtension();
$path = public_path('uploads/avatars/' . $file_name);
Image::make($image->getRealPath())->resize(84, 84)->save($path);
$user->avatar = $file_name;
}
if (Input::get('avatar_delete') == 1 && Input::file('avatar') == "") {
$user->avatar = null;
}
if ($user->save()) {
return redirect()->route('profile')->with('success', 'Account successfully updated');
}
return redirect()->back()->withInput()->withErrors($user->getErrors());
}