尝试调整大小并将图像调整为宽度。这是代码:
<?php
require 'vendor/autoload.php';
use Imagine\Image\Box;
use Imagine\Image\Point;
$imagine = new Imagine\Gd\Imagine();
$image = $imagine->open('img.jpg');
$image->widen(600)->save('resized_img.jpg');
?>
和错误:
PHP Fatal error: Call to undefined method Imagine\Gd\Image::widen() in resize.php on line 11
我做错了什么?
答案 0 :(得分:1)
好的,所以这是正确的方法:
<?php
require 'vendor/autoload.php';
use Imagine\Image\Box;
use Imagine\Image\Point;
$imagine = new Imagine\Gd\Imagine();
$image = $imagine->open('img.jpg');
$image->resize($image->getSize()->widen(600))->save('resized_img.jpg');
?>