0
我使用imgAreaSelect插件讓用戶裁剪圖像。我想阻止用戶在不剪切圖像的情況下點擊保存按鈕。我正在尋找解決方案在JavaScript中,而不是檢查服務器端,如果圖像已被裁剪。如何防止未經imgAreaSelect剪切圖像保存
我使用imgAreaSelect插件讓用戶裁剪圖像。我想阻止用戶在不剪切圖像的情況下點擊保存按鈕。我正在尋找解決方案在JavaScript中,而不是檢查服務器端,如果圖像已被裁剪。如何防止未經imgAreaSelect剪切圖像保存
從imgAreaSelect API的樣本:
$('img#photo').imgAreaSelect({
onSelectEnd: function (img, selection) {
alert('width: ' + selection.width + '; height: ' + selection.height);
}
});
只是檢查是否selection.width
和selection.height
是> 0