Click here to Skip to main content
15,896,207 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionsession variable Pin
kuwl_mark8-May-06 3:22
kuwl_mark8-May-06 3:22 
AnswerRe: session variable Pin
Lexa19838-May-06 3:52
Lexa19838-May-06 3:52 
GeneralRe: session variable Pin
kuwl_mark8-May-06 18:35
kuwl_mark8-May-06 18:35 
QuestionProblems in loading an ActiveX object containing AXSpreadSheet web office component in a WebForm Pin
Aleemulhaq8-May-06 2:38
Aleemulhaq8-May-06 2:38 
QuestionSession Pin
kuwl_mark8-May-06 2:34
kuwl_mark8-May-06 2:34 
QuestionIIS metabase Error Pin
hasan19828-May-06 1:25
hasan19828-May-06 1:25 
Questionlanguge Pin
TAREQ F ABUZUHRI8-May-06 1:12
TAREQ F ABUZUHRI8-May-06 1:12 
AnswerRe: languge Pin
TAREQ F ABUZUHRI8-May-06 1:19
TAREQ F ABUZUHRI8-May-06 1:19 
this is the code
<%@ Page Language="C#"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.Security" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>

<%@ Import Namespace="System.Web.UI.HtmlControls" %>





protected void Page_Load(object sender, EventArgs e)
{
//String path = "C:\\sites\\Single11\\abuzuhri\\webroot\\blocket\\newupload"; //"C:\\Documents and Settings\\Builder\\Desktop\\testim";
//c:\sites\Single11\abuzuhri
// String newPath = "C:\\sites\\Single11\\abuzuhri\\webroot\\blocket\\upload\\"; //"C:\\Documents and Settings\\Builder\\Desktop\\testim\\newPasth\\";

String path = Server.MapPath("newupload");
String newPath = Server.MapPath("upload")+"\\";

int sW = 72;
int sH = 63;
int bW = 640;
int bh = 480;
float factor1 = float.Parse("1.0");
float factor2 = float.Parse("1.0");

// Create The new directory with the name specified in the textbox

string[] images = Directory.GetFiles(path);// this array contain ALL files in the specified directory

int couter = 0; // this will count the number of images in the folder
for (int i = 0; i < images.Length; i++)
{

// select only the image format in the folder
string fileExtention = images[i].Substring(images[i].Length - 3, 3);
if (fileExtention == "bmp" || fileExtention == "jpg" || fileExtention == "JPG" || fileExtention == "BMP" || fileExtention == "gif" || fileExtention == "Gif")
{
couter++;

System.Drawing.Image currentImage = System.Drawing.Image.FromFile(images[i]);
int h = currentImage.Height;
int w = currentImage.Width;

if (w > h)
{
factor1 = sW / (float)w;
factor2 = bW / (float)w;
}
else
{
factor1 = sH / (float)h;
factor2 = bh / (float)h;
}

if (factor1 > 1)
factor1 = (float)1.0;
if (factor2 > 1)
factor2 = (float)1.0;

// calculate the new dimensions according to the resizing factor
int newH1 = (int)((double)h * factor1);
int newW1 = (int)((double)w * factor1);

int newH2 = (int)((double)h * factor2);
int newW2 = (int)((double)w * factor2);

// get the Image name from the path
string imageName = images[i].Substring(path.Length + 1, images[i].Length - path.Length - 5);

// create the new bitmap with the specified size
//Bitmap ss=new Bitmap(
Bitmap newBitmap1 = new Bitmap(currentImage, newW1, newH1);
Bitmap newBitmap2 = new Bitmap(currentImage, newW2, newH2);

// according to type of the file we will save the new image

if (fileExtention == "bmp" || fileExtention == "BMP")
{
newBitmap1.Save(newPath + "PalSoq.com" + imageName + ".bmp", ImageFormat.Bmp);
newBitmap2.Save(newPath + "PalSoq.comB" + imageName + ".bmp", ImageFormat.Bmp);
}
else if (fileExtention == "JPG" || fileExtention == "jpg")
{
newBitmap1.Save(newPath + "PalSoq.com" + imageName + ".jpg", ImageFormat.Jpeg);
newBitmap2.Save(newPath + "PalSoq.comB" + imageName + ".jpg", ImageFormat.Jpeg);
}
else if (fileExtention == "gif" || fileExtention == "GIF")
{
newBitmap1.Save(newPath + "PalSoq.com" + imageName + ".gif", ImageFormat.Gif);
newBitmap2.Save(newPath + "PalSoq.comB" + imageName + ".gif", ImageFormat.Gif);
}
newBitmap1.Dispose();
newBitmap2.Dispose();
currentImage.Dispose();
}

File.Delete(images[i]);
}
lbl1.Text = couter.ToString();

}



<title>سوق بيع و شراء المستعمل

























































<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
="" id="NewFlash" width="210" height="28" align="">
<param name="movie" value="images/buttons11.swf" /> <param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#FFFFFF" />
<embed src="images/buttons11.swf" wmode="transparent" quality="high" bgcolor="#FFFFFF"
="" swliveconnect="FALSE" width="210" height="28" name="menu" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />




<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
="" id="OBJECT1" width="474" height="19" align="">
<param name="movie" value="images/menu.swf" /> <param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#FFFFFF" />
<embed src="images/menu.swf" wmode="transparent" quality="high" bgcolor="#FFFFFF"
="" swliveconnect="FALSE" width="474" height="19" name="menu" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />


























 
















 

 

تم تعديل
الصور بنجاح


<asp:label id="lbl1" runat="server" text="Label">  صورة تم تعديلها

 

 


 

 


 














جميع حقوق الطبع محفوظة  2006 ©














Palestine
QuestionError in asp.net Pin
tjpraveen238-May-06 0:13
tjpraveen238-May-06 0:13 
AnswerRe: Error in asp.net Pin
Bhasker Pinninti8-May-06 2:07
Bhasker Pinninti8-May-06 2:07 
Questionimage upload in asp.net 1.1 Pin
amaneet8-May-06 0:08
amaneet8-May-06 0:08 
QuestionProblem with Dev server. Pin
Bhasker Pinninti8-May-06 0:05
Bhasker Pinninti8-May-06 0:05 
QuestionHow to incorporate the changes to the dataset from database? Pin
jjsforyou8-May-06 0:02
jjsforyou8-May-06 0:02 
AnswerRe: How to incorporate the changes to the dataset from database? Pin
ssoffline8-May-06 0:47
ssoffline8-May-06 0:47 
Questiondatalist in asp.net 1.1 Pin
amaneet7-May-06 22:54
amaneet7-May-06 22:54 
QuestionAutoLoad Textboxes Pin
Commickey7-May-06 22:53
Commickey7-May-06 22:53 
AnswerRe: AutoLoad Textboxes Pin
ssoffline8-May-06 0:40
ssoffline8-May-06 0:40 
GeneralRe: AutoLoad Textboxes Pin
Commickey8-May-06 0:45
Commickey8-May-06 0:45 
QuestionDinamic show of price Pin
papa19807-May-06 22:05
papa19807-May-06 22:05 
AnswerRe: Dinamic show of price Pin
Guffa7-May-06 22:48
Guffa7-May-06 22:48 
GeneralRe: Dinamic show of price Pin
papa19807-May-06 23:04
papa19807-May-06 23:04 
Questionasp.net 2.0 logout Pin
fmardani7-May-06 21:26
fmardani7-May-06 21:26 
AnswerRe: asp.net 2.0 logout Pin
ssoffline8-May-06 1:01
ssoffline8-May-06 1:01 
GeneralRe: asp.net 2.0 logout Pin
fmardani8-May-06 2:51
fmardani8-May-06 2:51 
QuestionEditing Pivot table data Pin
sohne7-May-06 21:15
sohne7-May-06 21:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.