首页 新闻 会员 周边

JQuery图片预览,剪切和上传出现了BUG ,

0
悬赏园豆:100 [待解决问题]

1.预览时在火狐中不显示图片;

2.在IE中显示了图片后,画了一个剪切框,就会出现

better in the time的主页 better in the time | 初学一级 | 园豆:102
提问于:2013-06-08 09:46
< >
分享
所有回答(6)
-3

这个好像是有专门的一个jquery插件的。

chenping2008 | 园豆:9836 (大侠五级) | 2013-06-08 11:00
-1
geass.. | 园豆:1821 (小虾三级) | 2013-06-08 11:24

大虾, 我想要一个jquery写的 图片预览 /剪切和上传。   预览 我已经解决不同浏览器兼容问题了,上传的话, 使用jquery+ajax 可以实现了 , 现在卡在了剪切 这里了 。您能不能  拿出个 jquery+aspx的图片预览+剪切+上传  的demo~   小嘀,感激不尽哈~

支持(0) 反对(0) better in the time | 园豆:102 (初学一级) | 2013-06-09 18:55
-1

预览不显示图片.

1.先看看框框中图片属性 的路径,看看该路径下是不是真的有该图片,这样可以区分是上传失败了,还是显示失败,

2.若是前者,查看上传代码,可参考该博文:传送门,另外LZ是预览原图片还是剪切之后的图片,如果是剪切之后的检查是否剪切是否已经保存,同2开始说明.

3.若是后者,查看博客园该文章:传送门看看能不能换个JQuery脚本,或者用用被人的插件.

4.贴上代码看看.

flyher | 园豆:195 (初学一级) | 2013-06-09 14:11

大虾, 虽不明,但觉厉。 您能不能拿出个deom 给我瞧瞧~  在下 感激不尽~

支持(0) 反对(0) better in the time | 园豆:102 (初学一级) | 2013-06-09 18:45
0

是不是css文件或css代码没有正确引用啊

慧☆星 | 园豆:5640 (大侠五级) | 2013-06-14 10:30
0

火狐安全性太高

SOUTHER | 园豆:825 (小虾三级) | 2013-06-18 20:44
0

index.chtml @{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Layout.cshtml"; } @section HeadCss{} @section HeadScript{

}

上传头像关闭
 
 
  • 拖拽,缩放左侧图片生成满意头像
 

@{} ----------------------------------------------- Controller: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.IO; using System.Drawing; using MvcApplication2.Models; namespace MvcApplication2.Controllers { public class HomeController : Controller { public ActionResult Index() { return View(); } [HttpPost] public JsonResult Upload(HttpPostedFileBase upImg) { string fileName = System.IO.Path.GetFileName(upImg.FileName); string filePhysicalPath = Server.MapPath("~/upload/" + fileName); string pic = "", error = ""; try { upImg.SaveAs(filePhysicalPath); pic = "/upload/" + fileName; } catch (Exception ex) { error = ex.Message; } return Json(new { pic = pic, error = error }); } [HttpPost] public ActionResult Crop(ModelA A,string N)//(int[] values,string path)int x1,int y1,int w1,int h1,string path { string path1 = HttpContext.Server.MapPath(N); Image orgImage = Image.FromFile(path1);//实例化iamge对象,path1就是这张图像的绝对URL Image currentImage = new Bitmap(A.W, A.H, System.Drawing.Imaging.PixelFormat.Format32bppRgb);//再实例化一个image对象,不过使用的是bitmap的构造方法,这里就是你要裁剪后的图像存放的对象 Graphics g = Graphics.FromImage(currentImage);//graphics用于对图像的处理,这里就是裁剪 Rectangle destRect = new Rectangle(0, 0, A.W, A.H); int x = A.X; int y = A.Y; int w = A.W; int h = A.H; Rectangle srcRect = new Rectangle(A.X, A.Y, w, h);//定义矩形框,裁剪有用的嘛 g.DrawImage(orgImage, destRect, srcRect, GraphicsUnit.Pixel);//裁剪图像了,第一个参数就是原图,第二个就是裁剪后的大小,第三个就是你要裁剪原图的哪部分,最后那个参数则是GraphicsUnit枚举的成员,它指定srcRect参数所用的度量单位。 g.Dispose(); orgImage.Dispose(); string path2 = HttpContext.Server.MapPath("../Content/(2)flowers.jpg");//最后保存就可以了 currentImage.Save(path2); return Json("成功!"); } } }

better in the time | 园豆:102 (初学一级) | 2013-06-25 14:21
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册