简体   繁体   English

使用动态宽度和高度裁剪图像的可见部分

[英]crop visible part of image with dynamically width and height

I have a div with overflow:hidden and an image inside that div.Also I have some buttons for zoom in zoom out and for moving the image to all directions via change of margin.How do I crop only the visible part of the image and save it ? 我有一个带有div:隐藏的div和该div内的图像,还有一些按钮用于放大缩小和通过改变边距将图像移动到所有方向。如何仅裁剪图像的可见部分和保存 ? Is it possible to do it with only javascript? 是否可以仅使用javascript?

You can't save an image with javascript. 您无法使用javascript保存图像。 You should do it with PHP. 您应该使用PHP来完成。 http://www.php.net/manual/en/function.imagecrop.php http://www.php.net/manual/zh/function.imagecrop.php

You can do it in combination with Jcrop. 您可以与Jcrop结合使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM