2

我正在寻找复制、调整大小和移动图像。这类似于 wordpress 在您上传时如何创建不同大小的图像。我希望这是可执行的,而无需在运行页面时上传任何正在运行的内容。

例子:

$imagePath = 'http://example.com/images/myimageonserver.jpg';
$newImagePath = 'http://example.com/images/new/myimageonserver.jpg';
$newImageWidth = 300;
$newImageHeight = 200;

有谁知道会执行此操作的脚本?或者一些可以完成此任务的有用功能。

4

5 回答 5

5

你试过GD库吗?很强大。

于 2011-05-27T19:51:38.733 回答
5

不久前我写了这个类来包装 GD 库函数。

你可以这样称呼它:

$image = new Image('original/path/to.file', 'destination/of/resized.file');
$image->resize(300, 200);
$image->output();
$image->clean();

更新:

这个类不再像上面解释的那样起作用。
这是一个新的例子:

$image = new Image();
$image->source('original/path/to.file');
$image->destination('destination/of/resized.file');
$image->Manipulate->Resize(300,200);
$image->output();
$image->clean();
于 2011-05-27T19:54:50.333 回答
1

使用GD LibImageMagick。对于 ImageMagick,它是resizeImage函数。

于 2011-05-27T19:53:10.013 回答
0

我不确定这是否是你想要完成的,但看看这是否有帮助:

http://php.net/manual/en/function.imagecopyresized.php

于 2011-05-27T19:56:24.693 回答
0

您可以使用基于 GD 库的 ImageWorkshop 类:http://phpimageworkshop.com/ 在 github 上:https ://github.com/Sybio/ImageWorkshop )

于 2012-08-03T22:47:25.740 回答