zoom插件实现图片放大缩小功能

不多说,上代码


js代码



html页面代码

zoom in zoom out

move up move left move right move bottom


在上面的js代码中,可以放置项目本身图片,也可以放置远程图片,从远程读入图片的代码和下载图片,以及从服务器本地与项目本地读取图片是同一个性质,都是通过流传输然后对文件进行处理

var imgv = $('')
这段话放置了远程调用图片的url

controller层代码:同下载

@RequestMapping("/queryImg")
	@ResponseBody
	public Map queryImg(String type,String fileName,HttpServletResponse response){
		OutputStream out = null;
		InputStream input = null;
		try{
		    URL url = new URL(ftputil.getFtpPath(new Ftp(type), fileName));
		    input = url.openStream();
			response.setContentType("application/octet-stream");
			response.setHeader("Content-Disposition","attachment; filename="+fileName);
			out = response.getOutputStream();
			int i = 0;
			byte[] buffer = new byte[2048];
			while((i = input.read(buffer)) != -1){
				out.write(buffer,0,i);
			}
			out.flush();
			input.close();
		}catch(Exception e){
			throw new SurveyServiceException("文件读取异常,详细请看日志", e);
		}finally{
			if(out != null){
				try {
					out.close();
				} catch (IOException e) {
					throw new SurveyServiceException("文件读取异常,详细请看日志", e);
				}
			}
			if(input != null){
				try {
					input.close();
				} catch (IOException e) {
					throw new SurveyServiceException("文件读取异常,详细请看日志", e);
				}
			}
		}
		return null;
	}


参考网址:http://www.html580.com/9995/

你可能感兴趣的:(html)