将图像剪裁为网页中的六角形 [英] Cropping an image into Hexagon shape in a web page

查看:92
本文介绍了将图像剪裁为网页中的六角形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网页中有图片。我想将四边形图像转换成六边形图像。即修剪边缘并将图像转换为六边形形状。

I have an image in a web page. I want to convert the four-sided image into a six-sided one. i.e. Crop the edges and convert the image into an hexagon shape.

如何在服务器端使用PHP ImageMagick / GD。我使用XAMPP服务器来构建一个示例网页。或者有更好的方法使用Javascript / CSS通过使用img样式属性。

How can I do it using PHP ImageMagick/GD on my server side. I am using XAMPP server to build a sample web page. Or is there a better way to do it using Javascript/CSS by making use of img style attributes.

推荐答案

不太痛苦的CSS(你甚至不需要JS这个)。

It'll be less painful in CSS (you don't even need JS on this).

看到这个小提琴 http://jsfiddle.net/kizu/bhGn4/

这篇关于将图像剪裁为网页中的六角形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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