473,573 Members | 4,141 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to rotate image upon upload?

Hi,
I have developed an upload server controls to be reused over a number of
projects. One of the tasks it needs to handle is to rotate an image. I want
to accoplish this by checking the checkbox that is next to the file field.
Once i browse for the file, i check the box to rotate and then upload.
However i am unable to get it to rotate when the box is checked. It only
rotates when i set a boolean (RotateImage) to true. Any ideas on how to go
about rotating by checking the box.?

Also, another question with respect to GDI+ - can i take existing image
(like a gif) and then stamp it on to another image - like a copyright
symbol.
Nov 18 '05 #1
7 2448
Hi,

see these GDI articles by Chris Garrett
http://authors.aspalliance.com/chris...asp?category=9

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Showjumper " <sh*******@grkj ashdjkf.com> wrote in message
news:Ou******** ******@TK2MSFTN GP11.phx.gbl...
Hi,
I have developed an upload server controls to be reused over a number of
projects. One of the tasks it needs to handle is to rotate an image. I want
to accoplish this by checking the checkbox that is next to the file field.
Once i browse for the file, i check the box to rotate and then upload.
However i am unable to get it to rotate when the box is checked. It only
rotates when i set a boolean (RotateImage) to true. Any ideas on how to go
about rotating by checking the box.?

Also, another question with respect to GDI+ - can i take existing image
(like a gif) and then stamp it on to another image - like a copyright
symbol.

Nov 18 '05 #2
I had already been through those articles. I know how to rotate the image -
it rotates just fine if a boolean is set in the properties panel. What i
want to do is have it rotate if the checkbox is checked - the checkbox is
next to the file field in the browser. Thats where my problem lies.
"Teemu Keiski" <jo****@aspalli ance.com> wrote in message
news:ez******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

see these GDI articles by Chris Garrett
http://authors.aspalliance.com/chris...asp?category=9

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Showjumper " <sh*******@grkj ashdjkf.com> wrote in message
news:Ou******** ******@TK2MSFTN GP11.phx.gbl...
Hi,
I have developed an upload server controls to be reused over a number of
projects. One of the tasks it needs to handle is to rotate an image. I want to accoplish this by checking the checkbox that is next to the file field.
Once i browse for the file, i check the box to rotate and then upload.
However i am unable to get it to rotate when the box is checked. It only
rotates when i set a boolean (RotateImage) to true. Any ideas on how to go
about rotating by checking the box.?

Also, another question with respect to GDI+ - can i take existing image
(like a gif) and then stamp it on to another image - like a copyright
symbol.


Nov 18 '05 #3
Ok, sorry for that. So you mean you can't read the CheckBox's Checked
property while uploading the image?

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"Showjumper " <sh*******@grkj ashdjkf.com> wrote in message
news:OR******** ******@TK2MSFTN GP12.phx.gbl...
I had already been through those articles. I know how to rotate the image -
it rotates just fine if a boolean is set in the properties panel. What i
want to do is have it rotate if the checkbox is checked - the checkbox is
next to the file field in the browser. Thats where my problem lies.
"Teemu Keiski" <jo****@aspalli ance.com> wrote in message
news:ez******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

see these GDI articles by Chris Garrett
http://authors.aspalliance.com/chris...asp?category=9

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Showjumper " <sh*******@grkj ashdjkf.com> wrote in message
news:Ou******** ******@TK2MSFTN GP11.phx.gbl...
Hi,
I have developed an upload server controls to be reused over a number of
projects. One of the tasks it needs to handle is to rotate an image. I want to accoplish this by checking the checkbox that is next to the file field.
Once i browse for the file, i check the box to rotate and then upload.
However i am unable to get it to rotate when the box is checked. It only
rotates when i set a boolean (RotateImage) to true. Any ideas on how to go
about rotating by checking the box.?

Also, another question with respect to GDI+ - can i take existing image
(like a gif) and then stamp it on to another image - like a copyright
symbol.



Nov 18 '05 #4
Right. This is a server control, btw. Not sure if it makes a difference. I
have the following in upload routine:
If RotateCheck.Che cked = True Then
RotateImages()
End If
And in the createchildcont rols i have
AddHandler btnButton.Click , AddressOf SaveImages

The rotate only works if a boolean is set to tru in the property window, not
if the checkbo is checked. Maybe i am missing something obvious.
Nov 18 '05 #5
Ok,

can you post more complete set of code?

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Showjumper " <sh*******@grkj ashdjkf.com> wrote in message
news:uY******** ******@TK2MSFTN GP12.phx.gbl...
Right. This is a server control, btw. Not sure if it makes a difference. I
have the following in upload routine:
If RotateCheck.Che cked = True Then
RotateImages()
End If
And in the createchildcont rols i have
AddHandler btnButton.Click , AddressOf SaveImages

The rotate only works if a boolean is set to tru in the property window, not
if the checkbo is checked. Maybe i am missing something obvious.

Nov 18 '05 #6
Here you go. If you need more let me know.

Private Function RotateImage(ByV al SourceImage As String, ByVal DestImage As
String) As Boolean
Dim g As System.Drawing. Image
g = System.Drawing. Image.FromFile( SourceImage)
g.RotateFlip(Sy stem.Drawing.Ro tateFlipType.Ro tate90FlipNone)
g.Save(DestImag e)
g.Dispose()
g = Nothing
End Function

'My call to function
If RotateCheck.Che cked = True Then
RotateImage(con text.Server.Map Path(_UploadDir ectory & "\") + _fileName,
context.Server. MapPath(_Upload Directory & "\") + _fileName)
End If

Protected Overrides Sub CreateChildCont rols()
' Add File Fields
Me.Controls.Add (New LiteralControl( "<div align=""" & _align & """ "))
For I = 1 To _NumberFileFiel ds
FileField = New HtmlControls.Ht mlInputFile
RotateCheck = New CheckBox
Me.Controls.Add (New LiteralControl( "<p>"))
Me.Controls.Add (FileField)
FileField.Size = _FileFieldSize
FileField.Attri butes.Add("clas s", _FileFieldCssCl ass)
Me.Controls.Add (RotateCheck)
Me.Controls.Add (New LiteralControl( "</p>"))
Next
' Add Submit Button
btnButton.Text = _ButtonText
btnButton.CssCl ass = _SubmitButtonCs sClass
AddHandler btnButton.Click , AddressOf SaveImages
Me.Controls.Add (btnButton)
'Add message
Me.Controls.Add (New LiteralControl( "<p class=""" & _UploadMsgCssCl ass &
""">"))
Me.Controls.Add (label1)
Me.Controls.Add (New LiteralControl( "</div>"))
End Sub

Nov 18 '05 #7
I know what the problem is. It works fine if it is only one checkbox on the
page. However i am wanting a checkbox next to each file field to allow each
image to be rotated independlty of the others or not at all. One checkbox on
the page the image is rotated. But it also rotates images that dont need to
be when multiple files are upped.
"Teemu Keiski" <jo****@aspalli ance.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Ok,

can you post more complete set of code?

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Showjumper " <sh*******@grkj ashdjkf.com> wrote in message
news:uY******** ******@TK2MSFTN GP12.phx.gbl...
Right. This is a server control, btw. Not sure if it makes a difference. I
have the following in upload routine:
If RotateCheck.Che cked = True Then
RotateImages()
End If
And in the createchildcont rols i have
AddHandler btnButton.Click , AddressOf SaveImages

The rotate only works if a boolean is set to tru in the property window, not if the checkbo is checked. Maybe i am missing something obvious.


Nov 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
8473
by: Nik Coughlin | last post by:
Are there methods for manipulating images in JavaScript that would allow me to write functions to rotate, skew, mask and resize images (bitmaps)? The functions need to be fast enough for use in a top-down scrolling game. Or would I be better off preprocessing all of the images with something server side such as PHP and then preloading them...
6
8235
by: Leo Koolsbergen | last post by:
Hallo, Maybe a very simpel problem, but I cannot find a solution. From a webcam I can retreive pictures, but as the cam is positioned upside down I have to rotate the (jpeg) pictures. I've searched about 50 javascripts sites, but I did not find what I am looking for. Can anyone help me with this? Greetings Leo Koolsbergen
3
2547
by: byrd48 | last post by:
Hi, I am developing a web site which allows users to upload and share photos. I have a datalist which lists the photos and has the usual edit, update commands. Within the edititemtemplate, I have links to allow the user to rotate the photo 90 degrees left or right. After I rebind the datalist,the photo is not rotated on the web page,...
35
2653
by: Stan Sainte-Rose | last post by:
Hi, What is the better way to save image into a database ? Just save the path into a field or save the image itself ? I have 20 000 images (~ 10/12 Ko per image ) to save. Stan
17
29386
by: santel_helvis | last post by:
Hi All, Could anyone tell me how to rotate the image in javascript. Which concepts I should concentrate to rotate the image
1
3064
by: iwdu15 | last post by:
hi, im trying to rotate a gdi drawn object on my form with a keypress....forinstance when i push the down arrow, for it to rotate the object drawn until the top is down, or if i push the right arrow key, to rotate the object until its pointed to the right. i tried using a drawing matrix to accomplish this, but all it did was rotate my entire...
8
16793
by: Samuel Shulman | last post by:
Is it possible and how to rotate pictures in HTML document Thank you, Samuel
1
9442
Thekid
by: Thekid | last post by:
Hi, I have an image similar to a clock, with numbers and letters going around in a circle. I need to extract the numbers and letters from the image and have them print out in a straight line and in order from inner circle working out. Here is an example of the image: http://img296.imageshack.us/my.php?image=screenimageqk9.jpg Since the...
0
1717
by: harryusa | last post by:
I am experimenting with the rotate function and so far I can't get my code to return anything but the URL of my script. Here it is: <?php // The file you are rotating $image = 'halloween.jpg'; //How many degrees you wish to rotate $degrees = 180;
0
7789
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7707
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8037
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8086
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6432
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3737
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3743
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2227
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1325
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.