摘要:一前臺頁面捷易拍控件測試程序啟動主啟動副停止保存保存保存保存保存保存灰度圖參數設置設置去黑邊自動矯正設置分辨率設置圖片壓縮率圖片壓縮率大小必須在之間創建目錄創建目錄成功刪除目錄刪除目錄成功刪除刪除文件成功測試啟動主啟動副停
一.前臺頁面:
捷易拍控件測試程序 - //啟動主
- function Start1_onclick() {
- captrue.bStartPlay();
- }
- //啟動副
- function Start2_onclick() {
- captrue.bStopPlay();
- captrue.bStartPlay2(0);
- }
- //停止
- function Stop_onclick() {
- var str = captrue.bStopPlay();
- }
- //保存JPG
- function SaveJPG_onclick() {
- captrue.vSetRotate(0);
- captrue.bSaveJPG("D:", "JPG");
- }
- //保存BMP
- function SaveBMP_onclick(){
- captrue.vSetRotate(0);
- captrue.bSaveBMP("D:", "BMP");
- }
- //保存PNG
- function SavePNG_onclick(){
- captrue.vSetRotate(0);
- captrue.bSavePNG("D:", "PNG");
- }
- //保存TIF
- function SaveTIF_onclick() {
- captrue.vSetRotate(270);
- captrue.vSetDPI(200, 200);
- captrue.vSetTIFPara(0.3, 0.59, 0.11, 0.2);
- var str = captrue.bSaveTIFEx("D:", "TIF", 0);
- }
- //保存TifJPG
- function SaveTifJPG_onclick() {
- captrue.vSetRotate(180);
- var str = captrue.bSaveTifJPG("D:", "tifJPG");
- }
- //保存灰度圖
- function SaveGray_onclick(){
- captrue.vSetRotate(0);
- captrue.bSaveGray("D:", "Gray");
- }
- function SaveMulTIF_onclick() {
- captrue.vSetRotate(0);
- captrue.vSetDPI(200, 200);
- var str = captrue.bSaveTIFEx("D:", "MulTIF", 1);
- }
- //參數設置
- function ParaSet_onclick() {
- captrue.displayVideoPara();
- }
- //PIN設置
- function ParaSetPIN_onclick() {
- captrue.vSetCapturePin();
- captrue.bStartPlay();
- }
- //去黑邊
- function CutHB_onclick(el) {
- if(el.checked){
- captrue.vSetDelHBFlag(1);
- } else {
- captrue.vSetDelHBFlag(0);
- }
- }
- //自動矯正
- function Skew_onclick(el) {
- if(el.checked){
- captrue.vSetSkewFlag(1);
- } else {
- captrue.vSetSkewFlag(0);
- }
- }
- //設置分辨率
- function selectResolution(el){
- captrue.vSetResolution(el.value);
- }
- //設置圖片壓縮率
- function setImageQuality(el){
- if(el.value >= 1 && el.value <=100){
- captrue.vSetImageQuality(el.value);
- } else {
- alert("圖片壓縮率大小必須在1-100之間");
- el.value = 70;
- }
- }
- //創建目錄
- function CreateDir_onclick(){
- var dir = "d:
- est";
- if(captrue.bCreateDir(dir)){
- alert("創建目錄"+dir+"成功");
- }
- }
- function DispDir_onclick(){
- captrue.bDispPath("d:");
- }
- //刪除目錄
- function DeleteDir_onclick() {
- var dir = "d:
- est";
- if(captrue.bDeleteFile(dir)){
- alert("刪除目錄"+dir+"成功");
- }
- }
- //刪除JPG
- function DeleteJPG_onclick() {
- var file = "D:JPG.jpg";
- if(captrue.bDeleteFile(file)){
- alert("刪除文件"+file+"成功");
- }
- }
- function StartPDF_onclick() {
- var str = captrue.bSavePDFStart("D:", "pdffile");
- }
- function ColorPDF_onclick() {
- var str = captrue.bSavePDFColorPage();
- }
- function BWPDF_onclick() {
- var str = captrue.bSavePDFBWPage();
- }
- function EndPDF_onclick() {
- var str = captrue.bSavePDFEnd();
- }
- function Base64_onclick() {
- var str = captrue.sGetBase64();
- document.getElementById("S1").value = str;
- }
- function upload_onclick(){
- var fileName = "d:JPG測試.JPG";
- var re = captrue.bUpLoadImageEx(fileName,"localhost",8080,"/ServletUploadDemo/UploadServlet",true,true);
- alert(re);
- }
二.后臺頁面:(注意需要的jar包,commons-fileupload-1.3.jar,commons-io-2.4.jar)
</>code
package com.jaeyi;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
public class UploadServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private String tempPath = "d:upload
emp";//臨時目錄
private String path = "d:upload";//上傳目錄
public UploadServlet(){
super();
}
public void destroy() {
super.destroy();
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet(request, response);
}
/**
* The doGet method of the servlet.
*
* This method is called when a form has its tag value method equals to get.
*
* @param request
* the request send by the client to the server
* @param response
* the response send by the server to the client
* @throws ServletException
* if an error occurred
* @throws IOException
* if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setCharacterEncoding("GBK");
request.setCharacterEncoding("GBK");
DiskFileItemFactory fac = new DiskFileItemFactory();
fac.setSizeThreshold(1024);
fac.setRepository(new File(tempPath));
ServletFileUpload upload = new ServletFileUpload(fac);
upload.setFileSizeMax(1024*1024*5);
try {
List fileList = upload.parseRequest(request);
Iterator iter = fileList.iterator();
while(iter.hasNext()){
FileItem fileItem = (FileItem)iter.next();
if(!fileItem.isFormField()){
String name = fileItem.getName();
String fileSize = new Long(fileItem.getSize()).toString();
if(name == null || name.equals("") || fileSize.equals("0"))
continue;
name = name.substring(name.lastIndexOf("")+1);
File saveFile = new File(new File(path),name);
fileItem.write(saveFile);
}
}
} catch (Exception e) {
e.printStackTrace();
throw new ServletException(e);
}
}
public void init() throws ServletException {
if(!new File(tempPath).exists()){
new File(tempPath).mkdirs();
}
if(!new File(path).exists()){
new File(path).mkdirs();
}
}
}
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://m.specialneedsforspecialkids.com/yun/86236.html
摘要:一前臺頁面捷易拍控件測試程序啟動主啟動副停止保存保存保存保存保存保存灰度圖參數設置設置去黑邊自動矯正設置分辨率設置圖片壓縮率圖片壓縮率大小必須在之間創建目錄創建目錄成功刪除目錄刪除目錄成功刪除刪除文件成功測試啟動主啟動副停 一.前臺頁面: 捷易拍控件測試程序 //啟動主 function Start1_onclick() { captrue.b...
摘要:網上也有不少人反饋用手機客戶端無法使用新浪郵箱發送郵件,隨后我嘗試用登錄新浪郵箱,也出現只能接收郵件而不能發送郵件的情況。三附錄錯誤碼及建議解決方法發送郵件成功卻收不到郵件或收到郵件無主題無收件人亂碼新浪郵箱誠信平臺 前言 ??JavaMail的使用本身并不難,網上有不少案例,簡單易懂,而且有詳細的中文注解。但是由于JavaMail的機制設置不夠完善,特別是異常出錯時的參考信息太少,給...
摘要:從零開始設計開發一個日處理數據億的大數據高并發實時系統,哪些性能問題需要特別注意這里我們一起梳理一下本文中我將以,同學戲稱的系統網易云捕設計開發實踐中兩年的時間里碰到的真實問題,踩過的坑及解決問題的方法和大家一起討論如何解決這些問題。 本文由作者余寶虹授權網易云社區發布。 從零開始設計開發一個日處理數據8億的大數據高并發實時系統,哪些性能問題需要特別注意?這里我們一起梳理一下,本文中我...
閱讀 2424·2021-11-25 09:43
閱讀 1257·2021-11-24 09:39
閱讀 757·2021-11-23 09:51
閱讀 2392·2021-09-07 10:18
閱讀 1883·2021-09-01 11:39
閱讀 2787·2019-08-30 15:52
閱讀 2601·2019-08-30 14:21
閱讀 2866·2019-08-29 16:57