谁能帮助我如何在Laravel中实现调整大小的图像?
我只有这个代码:
if($request->hasFile('image')){
if (Input::file('image')->isValid()) {
$file = Input::file('image');
$destination = base_path() . '/public/images/ServiceImages';
$extension = Input::file('image')->getClientOriginalExtension();
$fileName = rand(111,99999).'.'.$extension;
if(!empty($data['Image'])){
unlink($destination.$data['Image']);
}
$file->move($destination, $fileName);
$service->image=$fileName;
}
}
Run Code Online (Sandbox Code Playgroud) 我想显示页面500内部服务器错误页面.当用户在项目中出现语法错误时,任何人都可以帮助我吗?如果我在语法上做了一些错误,我想展示那个特殊的刀片.
我已成功找到月份的全名,但我想要一个月份的简称.谁能帮我.我正在使用Moment.js我已经成功找到了这个月但我希望简短形式
这里是我的代码:
var date = '<?php echo date("Y-m-d") ?>';
var Month = moment(date, 'YYY-MM-DD').format('DD/MMMM')
console.log(Month);
Run Code Online (Sandbox Code Playgroud)
它回报了我06/February
,但我想要06/Feb
提前致谢 :)
我正在使用laravel 5.2
我想在我们创建的领域中保存印度时间,任何人都可以帮助我如何做到这一点.当用户注册时我必须做什么类型的设置?我希望将印度时间存储在created_at字段中.就像在whatsapp聊天中一样,你看到当我们在印度聊天时,它会显示我们聊天时的印度时间.
这是我的代码:
$current = Carbon::now();
$current = new Carbon();
$today = Carbon::today();
Run Code Online (Sandbox Code Playgroud)
但它让我回到英国的时间日期.
我正在使用 PhpSpreasdheet php 库。我已经完成了几乎所有我想要对特定列进行求和并想要显示该列的总计的操作。请参阅下面的我的输出:-
我尝试过下面的代码:-
$spreadsheet = new Spreadsheet();
$Excel_writer = new Xlsx($spreadsheet);
$spreadsheet->setActiveSheetIndex(0);
$activeSheet = $spreadsheet->getActiveSheet();
$activeSheet->setCellValue('A1', 'Location');
$activeSheet->setCellValue('B1', 'Media Vehicle');
$activeSheet->setCellValue('C1', 'Dimension');
$activeSheet->setCellValue('D1', 'Amount');
$spreadsheet->getActiveSheet()->setAutoFilter('A1:D1');
$locations = DB::table('locations')->get();
$locations = json_decode(json_encode($locations),true);
$i = 2;
foreach($locations as $location){
$activeSheet->setCellValue('A'.$i , $location['location']);
$activeSheet->setCellValue('B'.$i , $location['media_vehicle']);
$activeSheet->setCellValue('C'.$i , $location['dimension']);
$activeSheet->setCellValue('D'.$i , $location['amount']);
$i++;
}
$samplepath = storage_path('/excels/sampleExcel'.str_random(5).'.xlsx');
$Excel_writer->save($samplepath);
echo 'saved'; die;
Run Code Online (Sandbox Code Playgroud)
我想要金额列的总计。我想要动态化。如果将来它是 10 行,那么它将计算 10 行的金额列计数。
如何更改 laravel maatwebsite excel 包中的工作表方向?我想从左变右。
A B C D
Run Code Online (Sandbox Code Playgroud)
到:
D C B A
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
$row = $this->userRepository->getById(1);
$data = $row;
Excel::create('test', function ($excel) use($data) {
$excel->sheet('sheet', function ($sheet) use($data) {
$sheet->fromArray($data, null, 'A1', false, false);
$sheet->row(1, function($row) {
});
});
})->store('xlsx', storage_path('excel/exports'))->download('xlsx');
Run Code Online (Sandbox Code Playgroud) 我正在使用Redis存储数据一切正常在我的本地系统中运行.我已经成功地使用此命令在laravel中安装了redis,还需要使用predis / predis 和安装了Redis的窗口设置.现在,当我在Redis中存储数据时,如下所示: -
Redis::set('first',"My first Test"); // put data in Redis key
echo Redis ::get('first'); // get data
Run Code Online (Sandbox Code Playgroud)
上面的代码在我的本地系统中工作正常.当我尝试在实时服务器中使用此代码时,它显示以下错误: -
请帮我解决这个问题.我们正在使用amazon-ec2服务器在此先感谢:)
I am using laravel 5.2 framework and i am using intervention package of laravel that runs fine for me. Now here i face one problem i don't know what i amd doing wrong. Please help:-
$myimage = Image::make(storage_path('app/images/test1.jpg'));
//Suppose $imyimage width is 3024 and height is 2016
$actualwidth = 3024;
$actualheight = 2016;
Run Code Online (Sandbox Code Playgroud)
Now, when i tried these sizes 3024 * 2016 pixel then watermark is not visible while when i zoom the image then it is visible Now suppose …
我想保存唯一的优惠券代码以及字符和数字的混合,它的长度应该是 6。我正在使用 Laravel 框架 5.2
enter code here
$data = $request->all();
unset($data['_token']);
//echo "<pre>"; print_r($data); die;
for ($i=1; $i <=$data['countvoucher']; $i++) {
$voucher = new Voucher;
$voucher->code = "123456";// it should be dynamic and unique
$voucher->percentage = $data['percentage'];
$voucher->usage = $data['usage'];
$voucher->expirydate = $data['expirydate'];
$voucher->save();
}
Run Code Online (Sandbox Code Playgroud)
$voucher->我想保存在这个文件中的代码谁能帮我
我正在尝试几天,我不知道为什么它不起作用。我想在中间设置单元格值。我的输出如下:
我的预期输出如下:
我想每一列都必须以我为中心,我已经尝试过以下代码:-
$styleArray = [
'font' => [
'bold' => true,
],
'alignment' => [
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
],
'fill' => [
'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
'startColor' => [
'argb' => '0070C0',
],
'endColor' => [
'argb' => '0070C0',
],
],
];
$spreadsheet->getDefaultStyle()->getFont()->setSize(10);
}
Run Code Online (Sandbox Code Playgroud)
我已经尝试了所有其他属性,例如HORIZONTAL_CENTER,RIGHT,LEFT,JUSTIFY..etc。请帮助我,我该怎么做。
我想在页面加载时禁用提交按钮,并且在完成页面加载后它变为活动状态,任何人都可以帮助我如何做到这一点
<form>
Firstname:
<input type="text">
<button type="submit" class="btn btn-primary">Submit</button>
</form>
Run Code Online (Sandbox Code Playgroud) php ×9
laravel-5.2 ×5
laravel ×4
javascript ×2
jquery ×2
amazon-ec2 ×1
datetime ×1
excel ×1
intervention ×1
laravel-5.4 ×1
momentjs ×1
phpexcel ×1
phpoffice ×1
redis ×1
watermark ×1