使用 javascript 裁剪图像

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4363807/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 11:11:16  来源:igfitidea点击:

Use javascript to crop image

javascript

提问by Sam

I want to put a sprite image in my website, and use javascript to crop it to many separate images, then put these images into an image array.

我想在我的网站中放置一个精灵图像,并使用 javascript 将其裁剪为许多单独的图像,然后将这些图像放入图像数组中。

Is this possible? Thanks.

这可能吗?谢谢。

回答by jordanstephens

Take a look at jCrop, if you're using jQuery or JavaScript Image Cropper UIif you're using prototype.

如果您使用的是原型,请查看jCrop,如果您使用的是 jQuery 或JavaScript Image Cropper UI

What server-side language are you using? If you just want a straight crop w/o the graphical interface it might be better to do it server side.

您使用的是什么服务器端语言?如果你只是想要一个没有图形界面的直接裁剪,最好在服务器端进行。

If you're using PHP, check out this tutorial on nettuts

如果您使用的是 PHP,请查看有关 nettuts 的教程

If you're using Ruby on Rails, check out Paperclip

如果您使用 Ruby on Rails,请查看Paperclip