Fork me on GitHub

高拍仪拍照SDK开发(良田影像S300L|S500L)

高拍仪拍照SDK开发下载地址:点击下载

本SDK适用于:良田影像S300L|S500L

高拍仪如图:

SDN开发包安装之后找到安装目录,如图:

大家找到各自需要的版本即可,需要注意的是如果需要上传图片到服务器的话,我已经写好了C#版的接收程序,代码如下:

 

<%@ WebHandler Language="C#" Class="FileUpload" %>

using System;
using System.Web;

public class FileUpload : IHttpHandler
{
    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        HttpPostedFile uploadFile = context.Request.Files[0];
        string fileName = System.IO.Path.GetFileName(uploadFile.FileName);
        int fileSize = uploadFile.ContentLength;
        string fileExt = System.IO.Path.GetExtension(fileName).ToLower();
        string message = "";
        if (!(fileExt == ".png" || fileExt == ".gif" || fileExt == ".jpg" || fileExt == ".jpeg"))
        {
            message = "图片类型只能为gif,png,jpg,jpeg";
            return;
        }
        else
        {
            if (fileSize > (int)(500 * 1024))
            {
                message = "图片大小不能超过500KB";
                return;
            }
            else
            {
                try
                {
                    string directoryPath = context.Server.MapPath("~/TmpFile/");
                    if (!System.IO.Directory.Exists(directoryPath))//不存在这个文件夹就创建这个文件夹 
                    {
                        System.IO.Directory.CreateDirectory(context.Server.MapPath("~/TmpFile/"));
                    }
                    uploadFile.SaveAs(context.Server.MapPath("~/TmpFile/") + fileName);
                    message = fileName;
                }
                catch (Exception ex)
                {
                    message = ex.Message;
                    return;
                }
            }
        }
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

}

 

JavaScript调用上传服务器代码:

function SetSelImgs() {
    var selImgs = ""; // 获取选中的图片
    for (var i = 0; i < EThumbnails.GetDisplayCount(); i++) {
        if (1 == EThumbnails.IsChecked(i)) {
            var fileName = EThumbnails.GetFilePath(i).replace("D:\\", "");
            ScanCtrl.UploadFileOfHTTP("http://xxx/FileUpload.ashx",
                EThumbnails.GetFilePath(i), fileName);
            selImgs += fileName + ",";
        }
    } document.getElementById("selImgs1").value = selImgs;
    if ("" == selImgs) {
        alert('请先选中上传图片!');
        return false;
    }
    return true;
}

 

百度云下载地址:链接:https://pan.baidu.com/s/1wUkJow9Xn2VL2FXMz9itHQ 密码:nn0v

 

posted @ 2014-12-30 18:47  磊哥|www.javacn.site  阅读(17188)  评论(12编辑  收藏  举报