【发布时间】:2015-04-28 01:01:19
【问题描述】:
我正在尝试使用 intervention 在 Laravel 中操作图像 我已经遵循了使用 imagick 所需的所有设置。我在 centOS 上使用 vagrant,这一切都表明一切正常,通过 phpinfo ();
当我运行以下命令时(来自控制器的代码片段)
public function store()
{
//Get all the user fields
$user = new User;
$user->username = Input::get('username');
$user->name = Input::get('name');
$user->email = Input::get('email');
$user->gender = Input::get('gender');
$user->country = Input::get('country');
$user->website = Input::get('website');
$user->bio = Input::get('bio');
//Check for and store user image
if (Input::HasFile('image'))
{
$image = Image::make(Input::file('image'));
$name = time() . '-' . $image->getClientOriginalName();
$image->resize(100, 100);
$image = $image->move(public_path() . '/images/avatars/', $name);
$user->image = $name;
}
$user->save();
return redirect('/admin/users');
}
它可以满足我的所有期望,但会调整图像大小。它从输入中获取图像,分配新名称并将其保存在正确的位置。当我在页面上查看它时,它只是原始大小。
这一切都没有错误,所以我不确定问题出在我的代码还是服务器端。
任何帮助表示赞赏。
【问题讨论】:
标签: php image-processing laravel-5