本文整理汇总了PHP中File::cleanDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP File::cleanDirectory方法的具体用法?PHP File::cleanDirectory怎么用?PHP File::cleanDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类File
的用法示例。
在下文中一共展示了File::cleanDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
DB::table('filter_images')->delete();
$success = File::cleanDirectory($this->getImagesPath());
File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore'));
// Create images for all filters. In this phase images for all the filter will be the same
$filters = Filter::all();
foreach ($filters as $filter) {
FilterImage::create(['filter_id' => $filter->id, 'image_name' => $this->copyImage(public_path() . '/backup_images/filters/gym.jpg')]);
// FilterImage::create([
// 'filter_id' => $filter->id,
// 'image_name' => $this->copyImage(public_path().'/backup_images/filters/hero.jpg')
// ]);
//
// FilterImage::create([
// 'filter_id' => $filter->id,
// 'image_name' => $this->copyImage(public_path().'/backup_images/filters/kitchen.jpg')
// ]);
//
// FilterImage::create([
// 'filter_id' => $filter->id,
// 'image_name' => $this->copyImage(public_path().'/backup_images/filters/living.jpg')
// ]);
}
}
示例2: tearDown
public function tearDown()
{
parent::tearDown();
$this->userFileStorage = null;
File::deleteDirectory($this->tmpDir);
File::cleanDirectory($this->storageDir);
}
示例3: run
public function run()
{
DB::table('availability_page')->delete();
$success = File::cleanDirectory($this->getImagesPath());
File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore'));
AvailabilityPage::create(['image_name' => ""]);
}
示例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: store
public function store(ContactFormRequest $request)
{
\Mail::send('emails.contact', array('firstname' => $request->get('firstname'), 'lastname' => $request->get('lastname'), 'email' => $request->get('email'), 'objet' => $request->get('objet'), 'bodyMessage' => $request->get('message'), 'url' => $request->get('url'), 'file' => $request->get('file'), 'copie' => $request->get('copie')), function ($message) use($request) {
/*si l'utilisateur a demandé à recevoir une copie du message par mail :*/
if ($request->copie === 'yes') {
$message->to($request->email, $request->firstname)->subject('copie de mon message à roadweb');
}
$message->from($request->email);
$message->to('hello@road-web.fr', 'Equipe Roadweb')->subject($request->objet);
$message->setReplyTo($request->email);
/*si l'utilisateur a envoyé une capture d'écran :*/
if (file_exists($request->file('file'))) {
$img = $request->file('file');
if ($img->isValid()) {
$path = config('images.contact');
$extension = $img->getClientOriginalExtension();
$name = 'capture.' . $extension;
$img->move($path, $name);
}
$file = $path . '/' . $name;
$message->attach($file);
}
});
$path = config('images.contact');
\File::cleanDirectory($path);
return \Redirect::route('contact')->with('message', 'Votre email a bien été envoyé ! L\'équipe Roadweb vous répondra dans les plus brefs délais.');
}
示例6: run
public function run()
{
DB::table('products_sika')->truncate();
File::cleanDirectory(public_path('assets/img/products/sika'));
File::makeDirectory(public_path('assets/img/products/sika/tech-carts'), true, true);
factory(App\ProductSika::class, 10)->create();
}
示例7: run
public function run()
{
DB::table('home_page_images')->delete();
$success = File::cleanDirectory($this->getImagesPath());
File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore'));
HomePageImages::create(['image' => $this->copyImage(public_path() . '/backup_images/building/entrance.jpg')]);
HomePageImages::create(['image' => $this->copyImage(public_path() . '/backup_images/building/hero.jpg')]);
HomePageImages::create(['image' => $this->copyImage(public_path() . '/backup_images/building/lobby.jpg')]);
}
示例8: destroy
/**
* Remove the specified resource from storage.
*
* @param PhotosRequest $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy(PhotosRequest $request, $id)
{
//
$imageDir = storage_path('app') . '/img/photos/' . $id;
\File::cleanDirectory($imageDir);
\File::deleteDirectory($imageDir);
Photos::find($id)->delete();
return \Redirect::back()->with('message', 'Fotoğraf Silindi!');
}
示例9: run
public function run()
{
DB::table('objects')->delete();
$success = File::cleanDirectory($this->getImagesPath());
File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore'));
Object::create(['name' => '202', 'unit' => '3D', 'bedrooms' => '3BD', 'bathrooms' => '2', 'interior' => '1200', 'exterior' => '1200', 'price' => '$2,050,000', 'common_charges' => '1200', 'taxes' => '$612', 'floor_plan_link' => 'http://adminsage.com/db/54/assets/unitplans/2b.pdf', 'shown' => 1]);
Object::create(['name' => '203', 'unit' => '4C', 'bedrooms' => '1BD', 'bathrooms' => '1', 'interior' => '700', 'exterior' => '700', 'price' => '$1,685,000', 'common_charges' => '800', 'taxes' => '$480', 'floor_plan_link' => 'http://adminsage.com/db/54/assets/unitplans/3f.pdf', 'shown' => 1]);
Object::create(['name' => '204', 'unit' => '8B', 'bedrooms' => '2BD', 'bathrooms' => '1', 'interior' => '900', 'exterior' => '900', 'price' => '$1,695,000', 'common_charges' => '2000', 'taxes' => '$483', 'floor_plan_link' => 'http://adminsage.com/db/54/assets/unitplans/4d.pdf', 'shown' => 1]);
}
示例10: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$this->call('dump-autoload');
$this->call('cache:clear');
// $this->call('migrate:refresh');
$this->call('db:seed');
File::cleanDirectory(public_path() . '/uploads');
file_put_contents(public_path() . '/uploads/.gitignore', "*\n!.gitignore");
}
示例11: run
public function run()
{
$faker = Faker::create();
$imgDir = public_path() . DS . 'assets' . DS . 'upload' . DS . 'images';
if (!File::exists($imgDir)) {
File::makeDirectory($imgDir, 0755);
}
File::cleanDirectory($imgDir, true);
foreach (range(1, 500) as $index) {
$dir = $imgDir . DS . $index;
if (!File::exists($dir)) {
File::makeDirectory($dir, 0755);
}
$width = $faker->numberBetween(800, 1024);
$height = $faker->numberBetween(800, 1024);
$orgImg = $faker->image($dir, $width, $height);
chmod($orgImg, 0755);
$img = str_replace($dir . DS, '', $orgImg);
$image = new Imagick($orgImg);
$dpi = $image->getImageResolution();
$dpi = $dpi['x'] > $dpi['y'] ? $dpi['x'] : $dpi['y'];
$size = $image->getImageLength();
$extension = strtolower($image->getImageFormat());
//get 5 most used colors from the image
$color_extractor = new ColorExtractor();
$myfile = $orgImg;
$mime_type = $image->getImageMimeType();
switch ($mime_type) {
case 'image/jpeg':
$palette_obj = $color_extractor->loadJpeg($myfile);
break;
case 'image/png':
$palette_obj = $color_extractor->loadPng($myfile);
break;
case 'image/gif':
$palette_obj = $color_extractor->loadGif($myfile);
break;
}
$main_color = '';
if (is_object($palette_obj)) {
$arr_palette = $palette_obj->extract(5);
if (!empty($arr_palette)) {
$main_color = strtolower($arr_palette[0]);
for ($i = 1; $i < count($arr_palette); $i++) {
$main_color .= ',' . strtolower($arr_palette[$i]);
}
}
}
//update field main_color from images table
$image_obj = VIImage::findorFail((int) $index);
$image_obj->main_color = $main_color;
$image_obj->save();
$id = VIImageDetail::insertGetId(['path' => 'assets/upload/images/' . $index . '/' . $img, 'height' => $height, 'width' => $width, 'ratio' => $width / $height, 'dpi' => $dpi, 'size' => $size, 'extension' => $extension, 'type' => 'main', 'image_id' => $index]);
BackgroundProcess::makeSize($id);
}
}
示例12: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$format = '%s%s';
$publicPath = public_path();
$pdfPath = sprintf($format, $publicPath, '/pdfs');
$descriptionPath = sprintf($format, $publicPath, '/descriptions');
$activitiesPath = sprintf($format, $publicPath, '/activities');
File::cleanDirectory($pdfPath);
File::cleanDirectory($descriptionPath);
File::cleanDirectory($activitiesPath);
}
示例13: run
public function run()
{
DB::table('residences')->delete();
$success = File::cleanDirectory($this->getImagesPath());
File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore'));
Residence::create(['name' => 'Living room', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/residences/living.jpg'), 'order_id' => 2]);
Residence::create(['name' => 'Kitchen', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/residences/kitchen.jpg'), 'order_id' => 1]);
Residence::create(['name' => 'Bedroom', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/residences/bedroom.jpg'), 'order_id' => 1]);
Residence::create(['name' => 'Bath', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/residences/bath.jpg'), 'order_id' => 3]);
Residence::create(['name' => 'Penthouse', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/residences/penthouse.jpg'), 'order_id' => 3]);
}
示例14: run
public function run()
{
DB::table('amenities')->delete();
$success = File::cleanDirectory($this->getImagesPath());
File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore'));
Amenitie::create(['name' => 'Lobby', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/amenities/lobby.jpg'), 'order_id' => 1]);
Amenitie::create(['name' => 'Lounge', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/amenities/lounge.jpg'), 'order_id' => 2]);
Amenitie::create(['name' => 'Terrace', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/amenities/terrace.jpg'), 'order_id' => 3]);
Amenitie::create(['name' => 'Children\'s Playroom', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/amenities/childrens_playroom.jpg')]);
Amenitie::create(['name' => 'Other amenities', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/amenities/other_amenities.jpg')]);
}
示例15: run
public function run()
{
DB::table('filters')->delete();
$success = File::cleanDirectory($this->getImagesPath());
File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore'));
Filter::create(['name' => 'Fitness', 'poi_url' => 'http://happyfist.co/pois/pois/POI/gyms.kml', 'text' => 'lorem', 'paragraph_title' => 'ipsum']);
Filter::create(['name' => 'Lodging', 'poi_url' => 'http://happyfist.co/pois/pois/POI/hotels.kml', 'text' => 'lorem', 'paragraph_title' => 'ipsum']);
Filter::create(['name' => 'Culture', 'poi_url' => 'http://happyfist.co/pois/pois/POI/artMuseums.kml', 'text' => 'lorem', 'paragraph_title' => 'ipsum']);
Filter::create(['name' => 'Entertainment', 'poi_url' => 'http://happyfist.co/pois/pois/POI/nightlife.kml', 'text' => 'lorem', 'paragraph_title' => 'ipsum']);
Filter::create(['name' => 'Dinning', 'poi_url' => 'http://happyfist.co/pois/pois/POI/restaurants.kml', 'text' => 'lorem', 'paragraph_title' => 'ipsum']);
Filter::create(['name' => 'Education', 'poi_url' => 'http://happyfist.co/pois/pois/POI/schools.kml', 'text' => 'lorem', 'paragraph_title' => 'ipsum']);
Filter::create(['name' => 'Retail', 'poi_url' => 'http://happyfist.co/pois/pois/POI/shop-and-specialities.kml', 'text' => 'lorem', 'paragraph_title' => 'ipsum']);
Filter::create(['name' => 'Transportation', 'poi_url' => 'http://happyfist.co/pois/pois/POI/transit.kml', 'text' => 'lorem', 'paragraph_title' => 'ipsum']);
}