截图Rectangle contructor with double type perameters with Jcrop for crop image

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="../js/jquery.min.js"></script>
<script src="../js/jquery.Jcrop.js"></script>
<script type="text/javascript">
jQuery(function ($) {
$(‘#imgCrop‘).Jcrop({
boxWidth: 450,
boxHeight: 400,
onSelect: getcroparea, // will tell the coordinates
minSize: [308, 308],
});
function getcroparea(c) {
jQuery(‘#X‘).val(c.x);
jQuery(‘#Y‘).val(c.y);
jQuery(‘#W‘).val(c.w);
jQuery(‘#H‘).val(c.h);
};
});
</script>
<link rel="stylesheet" href="demo_files/main.css" type="text/css" />
<link rel="stylesheet" href="demo_files/demos.css" type="text/css" />
<link rel="stylesheet" href="../css/jquery.Jcrop.css" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<!-- This is the image we‘re attaching Jcrop to -->
<img src="demo_files/sago.jpg" id="imgCrop" alt="[Jcrop Example]" />
<asp:Button ID="btnCrop" runat="server" Text="Crop" OnClick="btnCrop_Click" />
</div>
<asp:Image ID="imgUpload" runat="server" ImageUrl="demo_files/sago.jpg" />
<asp:HiddenField ID="X" runat="server" Value="22" />
<asp:HiddenField ID="Y" runat="server" Value="122" />
<asp:HiddenField ID="W" runat="server" Value="212"/>
<asp:HiddenField ID="H" runat="server" Value="22" />
</form>
</body>
</html>

 protected void btnCrop_Click(object sender, EventArgs e)
{
// Crop Image Here & Save
string fileName = Path.GetFileName(imgUpload.ImageUrl);
string filePath = Path.Combine(Server.MapPath("~/UploadImages"), fileName);
string cropFileName = "";
string cropFilePath = "";
if (File.Exists(filePath))
{
System.Drawing.Image orgImg = System.Drawing.Image.FromFile(filePath);
Rectangle CropArea = new Rectangle(
Convert.ToInt32(X.Value),
Convert.ToInt32(Y.Value),
Convert.ToInt32(W.Value),
Convert.ToInt32(H.Value));
try
{
Bitmap bitMap = new Bitmap(CropArea.Width, CropArea.Height);
using (Graphics g = Graphics.FromImage(bitMap))
{
g.DrawImage(orgImg, new Rectangle(0, 0, bitMap.Width, bitMap.Height), CropArea, GraphicsUnit.Pixel);
}
cropFileName = "crop_" + fileName;
cropFilePath = Path.Combine(Server.MapPath("~/UploadImages"), cropFileName);
bitMap.Save(cropFilePath);
Response.Redirect("~/UploadImages/" + cropFileName, false);
}
catch (Exception ex)
{
throw;
}
}
}

Box Sizing
Method

http://forums.asp.net/t/1977993.aspx?Input+string+was+not+in+a+correct+format+when+i+upload+an+image

Hope it helps you.

http://forums.asp.net/t/1977993.aspx?Input+string+was+not+in+a+correct+format+when+i+upload+an+image

截图Rectangle contructor with double type perameters with Jcrop
for crop image

时间: 2024-10-09 11:49:37

截图Rectangle contructor with double type perameters with Jcrop for crop image的相关文章

关于类型Type

每一个JC语法节点都含有type属性,因为做为所有JC语法节点的父节点JCTree含有type属性.其继承关系如下图. 下面看一下Type类的定义及重要的属性. public class Type implements PrimitiveType { /** The tag of this type. * * @see TypeTags */ public int tag; /** The defining class / interface / package / type variable

Type Encodings

https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html#//apple_ref/doc/uid/TP40008048-CH100-SW1 To assist the runtime system, the compiler encodes the return and argument types for

asp.net获取屏幕截图、活动窗口截图

Rectangle R = System.Windows.Forms.Screen.PrimaryScreen.Bounds;//获取活动窗口截图 //Rectangle R = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea;//获取整个屏幕截图 System.Drawing.Image img = new Bitmap(R.Width, R.Height); Graphics G = Graphics.FromImage(img);

NGUI Sprite的各种Type(Simple、Sliced、Tiled、Filed、Advanced)

官方文档:http://www.tasharen.com/forum/index.php?topic=6704.0 下面是UISprite的Type截图,每一种Type都有不同的用途,在实际的项目中我们根据实际需求选择Type. 每一种Type的解释及适用场景: Simple:标准的Sprite,自适应大小 Sliced:九宫格切片,创建固定边框控件的最佳选择.边框固定,图片中间做拉伸(缩放),如角色头像,按钮背景 Tiled:平铺,一个Sprite缩放填充整个区域,如背景平铺 Filed:每个

C++中string类型对象和double型变量之间的互相转换

//convert string type value to double type value string s = "23"; double d; istringstream is(s); is>>d; cout<<d<<endl;   //输出23 //convert double type value to string type value double d=45; string s; ostringstream os; os<<

String Format for Double [C#]

转载:http://www.csharp-examples.net/string-format-double/ he following examples show how to format float numbers to string in C#. You can use static method String.Format or instance methods double.ToString and float.ToString. Digits after decimal point

imshow函数的uint8形式和double形式_转自http://www.tuicool.com/articles/FZ7Vj2R

最近在用octave (类似于matlab的计算软件, 函数和matlab一致) 写程序的时候, 在显示图像和保存图像的时候遇到了一些小问题, 所以简单的总结了一下. 本文用的图像为灰度图像: imread() 返回的图像类型是uint8类型, 这时用imshow显示图像的时候, imshow会认为输入矩阵的范围在0-255, 如果imshow的参数为double类型的,那么imshow认为输入矩阵的值为0-1. 很多时候需要将图像转换为double类型的, 但是转换以后直接使用imshow显示

System.Type类

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Reflection; namespace ConsoleApplication1 {     class Program     {         static void Main(string[] args)         {    

join on different data type

SELECT ....FROM A LEFT SEMI JOIN BON (A.col1 = B.col2)WHERE ..."If A.col1 is of DOUBLE type, but B.col2 is of BIGINT,  will print WARNING: Comparing a bigint and a double may result in a loss of precision.   Why can't cast col2 to double automaticall