/** * 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()); }
/** * 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; }
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]); }
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')]); }
/** * 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 "; }); }
/** * 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('/'); }
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"); }
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'); }
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'; }
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; }
/** * @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'); }
/** * 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); }
/** * 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); } }
/** * 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'); }); }
/** * Validates and stores the user's update data. * * @author [A. Gianotto] [<*****@*****.**>] * @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()); }
/** * Run the database seeds. * * @return void */ public function run() { $productAttributeGroup = ProductAttributeGroup::create(['title' => 'Basic']); $seoGroup = ProductAttributeGroup::create(['title' => 'SEO']); $inventoryGroup = ProductAttributeGroup::create(['title' => 'Inventory']); ProductAttribute::insert([['title' => 'Title', 'product_attribute_group_id' => $productAttributeGroup->id, 'identifier' => 'title', 'type' => 'VARCHAR', 'field_type' => 'TEXT', 'validation' => 'required|max:255'], ['title' => 'Price', 'product_attribute_group_id' => $productAttributeGroup->id, 'identifier' => 'price', 'type' => 'FLOAT', 'field_type' => 'TEXT', 'validation' => 'required|max:8|regex:/^-?\\d*(\\.\\d+)?$/'], ['title' => 'Image', 'product_attribute_group_id' => 0, 'identifier' => 'image', 'type' => 'FILE', 'field_type' => 'FILE', 'validation' => ''], ['title' => 'SKU', 'product_attribute_group_id' => $productAttributeGroup->id, 'identifier' => 'sku', 'type' => 'VARCHAR', 'field_type' => 'TEXT', 'validation' => 'required|max:255'], ['title' => 'Slug', 'product_attribute_group_id' => $productAttributeGroup->id, 'identifier' => 'slug', 'type' => 'VARCHAR', 'field_type' => 'TEXT', 'validation' => 'required|max:255|alpha_dash'], ['title' => 'Page Title', 'product_attribute_group_id' => $seoGroup->id, 'identifier' => 'page_title', 'type' => 'VARCHAR', 'field_type' => 'TEXT', 'validation' => 'max:255'], ['title' => 'Page Description', 'product_attribute_group_id' => $seoGroup->id, 'identifier' => 'page_description', 'type' => 'VARCHAR', 'field_type' => 'TEXTAREA', 'validation' => 'max:255'], ['title' => 'Qty', 'product_attribute_group_id' => $inventoryGroup->id, 'identifier' => 'qty', 'type' => 'VARCHAR', 'field_type' => 'TEXT', 'validation' => ''], ['title' => 'Description', 'product_attribute_group_id' => $productAttributeGroup->id, 'identifier' => 'description', 'type' => 'TEXT', 'field_type' => 'TEXTAREA', 'validation' => 'required']]); $statusAttribute = ProductAttribute::create(['title' => 'Status', 'product_attribute_group_id' => $productAttributeGroup->id, 'identifier' => 'status', 'type' => 'VARCHAR', 'field_type' => 'SELECT', 'validation' => 'required']); AttributeDropdownOption::create(['product_attribute_id' => $statusAttribute->id, 'value' => '1', 'label' => 'Enabled']); AttributeDropdownOption::create(['product_attribute_id' => $statusAttribute->id, 'value' => '0', 'label' => 'Disabled']); $isTaxableAttribute = ProductAttribute::create(['title' => 'Is Taxable', 'product_attribute_group_id' => $inventoryGroup->id, 'identifier' => 'is_taxable', 'type' => 'VARCHAR', 'field_type' => 'SELECT', 'validation' => 'required']); AttributeDropdownOption::create(['product_attribute_id' => $isTaxableAttribute->id, 'value' => '1', 'label' => 'Yes']); AttributeDropdownOption::create(['product_attribute_id' => $isTaxableAttribute->id, 'value' => '0', 'label' => 'No']); $featureAttribute = ProductAttribute::create(['title' => 'Is Featured', 'product_attribute_group_id' => $productAttributeGroup->id, 'identifier' => 'is_featured', 'type' => 'VARCHAR', 'field_type' => 'SELECT', 'validation' => 'required']); AttributeDropdownOption::create(['product_attribute_id' => $featureAttribute->id, 'value' => '0', 'label' => 'No']); AttributeDropdownOption::create(['product_attribute_id' => $featureAttribute->id, 'value' => '1', 'label' => 'Yes']); $inStockAttribute = ProductAttribute::create(['title' => 'In Stock', 'product_attribute_group_id' => $inventoryGroup->id, 'identifier' => 'in_stock', 'type' => 'VARCHAR', 'field_type' => 'SELECT', 'validation' => 'required']); AttributeDropdownOption::create(['product_attribute_id' => $inStockAttribute->id, 'value' => '1', 'label' => 'Yes']); AttributeDropdownOption::create(['product_attribute_id' => $inStockAttribute->id, 'value' => '0', 'label' => 'No']); $trackStockAttribute = ProductAttribute::create(['title' => 'Track Stock', 'product_attribute_group_id' => $inventoryGroup->id, 'identifier' => 'track_stock', 'type' => 'VARCHAR', 'field_type' => 'SELECT', 'validation' => '']); AttributeDropdownOption::create(['product_attribute_id' => $trackStockAttribute->id, 'value' => '1', 'label' => 'Yes']); AttributeDropdownOption::create(['product_attribute_id' => $trackStockAttribute->id, 'value' => '0', 'label' => 'No']); OrderStatus::insert(['title' => 'pending', 'is_default' => 1, 'is_last_stage' => 0], ['title' => 'processing', 'is_default' => 0, 'is_last_stage' => 0], ['title' => 'complete', 'is_default' => 0, 'is_last_stage' => 1]); $path = public_path() . '/countries.json'; $json = json_decode(file_get_contents($path), true); foreach ($json as $code => $name) { $countires[] = ['code' => $code, 'name' => $name]; } Country::insert($countires); }
public function run() { DB::table('mst_countries')->truncate(); $country_name_full = array(); $country_name_file = app_path() . "/country_name_new.txt"; $myfile_country_name = fopen($country_name_file, "r") or die("Unable to open file!"); $read_country_name_file = fread($myfile_country_name, filesize($country_name_file)); $array_country_names = explode("\n", $read_country_name_file); foreach ($array_country_names as $key_country_names) { if ($key_country_names != null) { $country_name_list = explode(" ", $key_country_names); $country_name_full[$country_name_list[0]] = $country_name_list[1]; } } $country_name_ja = ""; $file_folder = public_path() . "/flags/"; //use the directory class $files = dir($file_folder); //read all files ;from the directory chdir($file_folder); $file_names = glob('*.png'); $i = 1; //$c = 1; foreach ($file_names as $file_name) { $country_name_en = explode('.', $file_name, -1); if (!empty($country_name_full[$country_name_en[0]])) { $country_name_ja = $country_name_full[$country_name_en[0]]; } $country = array("country_name" => $country_name_en[0], "flag_url" => "flags/" . $file_name, "country_name_ja" => $country_name_ja); Country::create($country); $i++; echo $i . "\n"; } closedir($files->handle); }
public function setAvatarAttribute($avatar) { if (is_object($avatar) && $avatar->isValid()) { ImageManagerStatic::make($avatar)->fit(150, 150)->save(public_path() . "/img/avatars/{$this->id}.jpg"); $this->attributes['avatar'] = true; } }
/** * Attach theme paths to a local Url. The Url must be a resource located on the asset path * of the current theme or it's parents. * * @param string $url * @return string */ public function url($url) { // return external URLs unmodified if (preg_match('/^((http(s?):)?\\/\\/)/i', $url)) { return $url; } // Is it on AWS? Dont lookup parent themes... if (preg_match('/^((http(s?):)?\\/\\/)/i', $this->assetPath)) { return $this->assetPath . '/' . ltrim($url, '/'); } // Lookup asset in current's theme asset path $fullUrl = (empty($this->assetPath) ? '' : '/') . $this->assetPath . '/' . ltrim($url, '/'); if (file_exists($fullPath = public_path($fullUrl))) { return $fullUrl; } // If not found then lookup in parent's theme asset path if ($this->getParent()) { return $this->getParent()->url($url); } // Asset not found at all. Error handling $action = \Config::get('themes.asset_not_found', 'LOG_ERROR'); if ($action == 'THROW_EXCEPTION') { throw new themeException("Asset not found [{$url}]"); } elseif ($action == 'LOG_ERROR') { \Log::warning("Asset not found [{$url}] in Theme [" . \Theme::get() . "]"); } elseif ($action === 'ASSUME_EXISTS') { $assetPath = \Theme::find(\Theme::get())->assetPath; return (empty($assetPath) ? '' : '/') . $assetPath . '/' . ltrim($url, '/'); } }
public function boot() { /*Assets , CKEDITOR*/ $this->publishes([__DIR__ . '/../assets/' => public_path('drauta/bloglaravel')], 'public'); /*Migrations*/ $this->publishes([__DIR__ . '/../database/migrations/' => database_path('migrations')], 'migrations'); }
/** * Set the Package Publishing * @return void */ private function setPublishers() { // views $this->publishes([__DIR__ . '/../Views/pages' => base_path('finch/pages')]); // assets $this->publishes([__DIR__ . '/../Assets' => public_path('campuslane/finch')], 'public'); }
public function showConnector() { $roots = $this->app->config->get('elfinder.roots', []); if (empty($roots)) { $dirs = (array) $this->app['config']->get('elfinder.dir', []); foreach ($dirs as $dir) { $roots[] = ['driver' => 'LocalFileSystem', 'path' => public_path($dir), 'URL' => url($dir), 'accessControl' => $this->app->config->get('elfinder.access')]; } $disks = (array) $this->app['config']->get('elfinder.disks', []); foreach ($disks as $key => $root) { if (is_string($root)) { $key = $root; $root = []; } $disk = app('filesystem')->disk($key); if ($disk instanceof FilesystemAdapter) { $defaults = ['driver' => 'Flysystem', 'filesystem' => $disk->getDriver(), 'alias' => $key]; $roots[] = array_merge($defaults, $root); } } } $opts = $this->app->config->get('elfinder.options', array()); $opts = array_merge(['roots' => $roots], $opts); // run elFinder $connector = new Connector(new \elFinder($opts)); $connector->run(); return $connector->getResponse(); }
public function postRegistro() { include_once public_path() . '/securimage/securimage.php'; $securimage = new Securimage(); $captcha_sesion = strtoupper($securimage->getCode()); include app_path() . "/include/cifrado.php"; $usuario = new Usuario(); $data = Input::all(); $data['captcha_sesion'] = $captcha_sesion; $data['captcha_code'] = strtoupper($data['captcha_code']); $data['fecha_nacimiento'] = $data['anyo'] . "-" . $data['mes'] . "-" . $data['dia']; foreach ($data as $key => $value) { if ($key != 'password' && $key != 'email') { $data[$key] = mb_strtoupper($value, 'UTF-8'); } } $data['password'] = encriptar($data['password']); $data['cod_verif'] = rand(111111, 999999); if (!$usuario->isValid($data)) { return Redirect::action('Usuario_UsuarioController@getRegistro')->withInput(Input::except('password'))->withErrors($usuario->errors)->with('id_municipio', $data['municipio']); } $usuario->fill($data); $usuario->save(); return Redirect::action('Usuario_UsuarioController@getVerificar', array($usuario->id))->with('message_ok', 'Registro Completado. Por favor, inserte el código de verificación que le hemos enviado a su correo electrónico. Gracias'); }
public function postUpload() { $agente = Agente::find(1); if (Input::hasFile('file')) { $file = Input::file('file'); $name = $file->getClientOriginalName(); $extension = $file->getClientOriginalExtension(); $size = File::size($file); //dd($extension); $data = array('nombre' => $name, 'extension' => $extension, 'size' => $size); $rules = array('extension' => 'required|mimes:jpeg'); $messages = array('required' => 'El campo :attribute es obligatorio.', 'min' => 'El campo :attribute no puede tener menos de :min carácteres.', 'email' => 'El campo :attribute debe ser un email válido.', 'max' => 'El campo :attribute no puede tener más de :max carácteres.', 'unique' => 'La factura ingresada ya está agregada en la base de datos.', 'confirmed' => 'Los passwords no coinciden.', 'mimes' => 'El campo :attribute debe ser un archivo de tipo :values.'); $validation = Validator::make($rules, $messages); if ($validation->fails()) { return Redirect::route('logo-post')->withInput()->withErrors($validation); } else { if ($extension != 'jpg') { return Redirect::route('logo-post')->with('global', 'Es necesario que la imagen sea de extension .jpg.'); } else { $path = public_path() . '/assets/img/'; $newName = 'logo'; $subir = $file->move($path, $newName . '.' . $extension); return Redirect::route('agente.index')->with('create', 'El logo ha sido actualizado correctamente!'); } } } else { return Redirect::route('logo-post')->with('global', 'Es necesario que selecciones una imagen.'); } }
/** * Boot the service provider. * * @return null */ public function boot() { // Publish configuration files $this->publishes([__DIR__ . '/../../config/emoji.php' => config_path('emoji.php')], 'config'); // Publish asset files $this->publishes([__DIR__ . '/../../assets' => public_path('ios-emoji')], 'public'); }
public static function dailyBackgroundURL() { # get the number of day in the year $numberOfDayInYear = date('z'); # if there is backgrounds-production directory, go with that, otherwise go with backgrounds # (backgrounds-production is too large to be included in the git repository) $directory = '/img/backgrounds-production/'; if (!file_exists(public_path() . $directory)) { $directory = '/img/backgrounds/'; } # get the number of background images & collect them in an array $i = 0; $fileListArray = array(); $dir = public_path() . $directory; if ($handle = opendir($dir)) { while (($file = readdir($handle)) !== false) { if (!in_array($file, array('.', '..')) && !is_dir($dir . $file) && !(substr($file, 0, 1) === ".")) { $fileListArray = array_add($fileListArray, $i, $file); $i++; } } } $numberOfBackgroundFiles = $i; # calculate which image will we use $imageNumber = $numberOfDayInYear % $numberOfBackgroundFiles; # create the url that will be passed to the view $imageName = $fileListArray[$imageNumber]; $dailyBackgroundURL = $directory . $imageName; return $dailyBackgroundURL; }
/** * Register bindings in the container. * * @return void */ public function register() { $this->mergeConfigFrom(__DIR__ . '/../config/admininja.php', 'admininja'); /** * Register admininja:publish command */ $this->app['command.admininja.publish'] = $this->app->share(function ($app) { return new Console\Commands\PublishCommand($app['files'], public_path()); }); $this->commands('command.admininja.publish'); /** * Configure admininja routes */ $routeConfig = ['prefix' => $this->app['config']->get('admininja.uri')]; $this->app['router']->group($routeConfig, function ($router) { $router->get('/', function () { return view('admininja::layouts.master'); }); $router->get('model/{model}', ['uses' => 'Mrkj\\Admininja\\Http\\Controllers\\ModelController@index', 'as' => 'admininja.model.index']); $router->get('model/{model}/create', ['uses' => 'Mrkj\\Admininja\\Http\\Controllers\\ModelController@create', 'as' => 'admininja.model.create']); $router->post('model/{model}', ['uses' => 'Mrkj\\Admininja\\Http\\Controllers\\ModelController@store', 'as' => 'admininja.model.store']); $router->get('model/{model}/{id}/edit', ['uses' => 'Mrkj\\Admininja\\Http\\Controllers\\ModelController@edit', 'as' => 'admininja.model.edit']); $router->put('model/{model}/{id}', ['uses' => 'Mrkj\\Admininja\\Http\\Controllers\\ModelController@update', 'as' => 'admininja.model.update']); $router->delete('model/{model}/{id}', ['uses' => 'Mrkj\\Admininja\\Http\\Controllers\\ModelController@destroy', 'as' => 'admininja.model.destroy']); }); $this->app['admininja'] = function () { return new Admininja(); }; }
/** * Get the URL to uploads_path folder * * @param string $path * @param bool $secure * @return string */ function uploads_path($upload) { if (file_exists(public_path() . 'uploads/' . $upload)) { return 'no image broh'; } return public_path() . '/uploads/' . ltrim($upload, '/'); }
public function create(Request $request) { $destinationPath = public_path('vids/'); $filename = time() . '.' . $request->file('video')->guessExtension(); $request->file('video')->move($destinationPath, $filename); Post::Create(['content' => $filename, 'description' => $request->description, 'category_id' => $request->category_id, 'premium' => $request->premium]); }
public function postimage(Request $request) { $user = User::whereId(Auth::user()->id)->first(); $path = public_path() . '/images/profiles/'; $currentimage = $path . $user->avatar; if ($user->avatar != 'default.png') { \File::delete($currentimage); } if (Input::hasFile('file')) { $this->validate($request, ['file' => ['required', 'image']]); $file = Input::file('file'); $filename = Auth::user()->id . '_' . time() . '.' . Input::file('file')->guessClientExtension(); $img = Image::make($file); $img->fit(300, 300, function ($constraint) { $constraint->aspectRatio(); })->save($path . $filename); $user->avatar = $filename; $user->save(); return 'ok -' . $filename; } else { $user->avatar = 'default.png'; $user->save(); return redirect('/membres/profil/'); } }