我正在尝试将文本转换为图像.我已经这样做了,但有些情况下文本不在图像框中
"The"这个词的"e"被删除了.我尝试过减小字体大小或增加图像的宽度,但在某些情况下,这会再次发生在另一个文本中.这是代码:
$new_line_position = 61;
$angle = 0;
$left = 20;
$top = 45;
$image_width = 1210;
$image_line_height = 45;
$content_input = wordwrap($content_input, $new_line_position, "\n", true);
$lineas = preg_split('/\\n/', $content_input);
$lines_breaks = count($lineas);
$image_height = $image_line_height * $lines_breaks;
$im = imagecreatetruecolor($image_width, $image_height);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, $image_width, $image_height, $white);
$font_ttf = public_path().'/fonts/'.$ttf_font;
foreach($lineas as $linea){
imagettftext($im, $font_size, $angle, $left, $top, $black, $font_ttf, $linea);
$top = …Run Code Online (Sandbox Code Playgroud) 我是 Laravel Mix 的新手,我无法添加 jquery 库 stellar,当我尝试npm run dev时,它向我显示此错误:未找到此依赖项:* jquery.stellar in ./resources/assets/js/bootstrap. js
但我已经使用npm install --save jquery.stellar或npm install jquery.stellar安装了它
这是我的 webpack 文件:webpack.mix.js:
const { mix } = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files. …Run Code Online (Sandbox Code Playgroud) 我正在做一个测试,但是当它尝试检查用户是否登录时失败了:
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Auth;
use App\User;
class RegisterTest extends TestCase
{
use RefreshDatabase;
/*.....
more test about registering
....*/
/** @test */
function redirect_to_home_page_and_logged_in_after_login()
{
$user = factory(User::class)->create([
'name' => 'Test',
'email' => 'test@hotmail.com',
'password' => '123456'
]);
$response = $this->post('login', [
'email' => 'test@hotmail.com',
'password' => '123456'
]);
//this works
$response->assertRedirect('/');
//this fails
$this->assertTrue(Auth::check());
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的控制器 HomeController:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class HomeController extends Controller
{
public function index() …Run Code Online (Sandbox Code Playgroud) 我使用 Laravel 5.8 和 Vue.js 2,这是我的 .vue 文件:
let data = new FormData();
data.append('name', this.name);
data.append('image',this.image)
data.append('_method', 'PATCH');
axios.patch('/url/' + this.id, data)
.then(({data}) => {
})
.catch((error) => {
});
Run Code Online (Sandbox Code Playgroud)
路线
let data = new FormData();
data.append('name', this.name);
data.append('image',this.image)
data.append('_method', 'PATCH');
axios.patch('/url/' + this.id, data)
.then(({data}) => {
})
.catch((error) => {
});
Run Code Online (Sandbox Code Playgroud)
错误
违反完整性约束:1048 列“名称”不能为空。
但是当我将方法更改为 POST 时,在我的 vue 文件和 web.php 中它都有效,发生了什么?我需要使用两种方法:发布新数据和修补更新。我能做些什么?
javascript ×2
laravel ×2
php ×2
axios ×1
fonts ×1
form-data ×1
gd ×1
imagettftext ×1
jquery ×1
laravel-5 ×1
laravel-mix ×1
node.js ×1
phpunit ×1
truetype ×1
vue.js ×1