如何裁剪图像在codeigniter? [英] how to crop image in codeigniter?

查看:86
本文介绍了如何裁剪图像在codeigniter?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用codeigniter建立一个项目,现在我需要创建一个拇指根据用户的选择。像他会给我X1,Y1,X2,Y2,X3,Y3,X4,Y4我想根据那4点裁剪图像。我检查了图像处理类。作物功能似乎很奇怪。任何帮助?

i'm using codeigniter to build a project and right now i need to create a thumb depending on user choice. like he will give me X1,Y1,X2,Y2,X3,Y3,X4,Y4 i want to crop the image depending on that 4 points. i checked the image manipulation class. the crop function seems to be very strange. any help please ?

推荐答案

我知道文档在图像库中的这个特定的函数是稀疏的。裁切功能要求您只提供给轴。然后它将沿着这些轴切割并返回更靠近中心的图像部分。因此,如果将x轴设置为10,y轴设置为10,它将删除图像的顶部10像素和图像的左边10像素。同样,如果将x轴设置为图像宽度-10,它将从图像右侧裁剪10像素。

I know that the documentation is sparse on this particular function in the image library. The crop function asks you only to supply to axises. It will then cut along these axes and return the part of the image which is closer to the center. So if you set the x axis to 10 and the y axis to 10 it will remove the top 10px of the image and the left 10 px of the image. Similarly, if you set the x axis to the image width - 10 it will crop 10 pixels from the right of the image.

你的四个位置告诉你真的是四个不同的轴。因此,您需要执行两个操作。你只需要在每个$ this-> image_lib-> crop()之间更改轴。

What your four positions tell you are really four different axises. Therefore, you need to do two operations. You just need to change the axises in between each $this->image_lib->crop().

如何找出这些轴取决于你如何获取这些数据。在数组中,作为单独的值等,所以我不会这样。

How to figure out these axises depends on how you get this data. In an array, as separate values etc. so I won't go into this.

这篇关于如何裁剪图像在codeigniter?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆