使用PHP裁剪图像 [英] Crop image using php
本文介绍了使用PHP裁剪图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想裁剪图片。是否可以这样做。如果是, crop()
函数将如何显示?
I want to crop an image. Is it possible to do like this. And if yes, how would the crop()
function look like?
$ imgURL
始终是 .jpg
图片。
$image = file_get_contents($imgURL);
$maxWidth = 100;
$height = 68;
$image = crop($image, $maxWidth, $height);
file_put_contents("media/imgname.jpg", $image);
function crop($image, $maxWidth, $height){
...how do I crop the image?
}
推荐答案
如果您有GD库已安装,请查看您可以使用的功能。如果您需要更多解释和示例,请查看此博客。
If you have the GD library installed, taked a look at the functions available to you. If you want more explanation and an example, take a look at this blog.
此外,还有很多 SO帖子帮助你。
Also, there's plenty of SO posts to help you along.
这篇关于使用PHP裁剪图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文