By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,110 Members | 1,541 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,110 IT Pros & Developers. It's quick & easy.

How to rotate image upon upload?

P: n/a
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
Share this Question
Share on Google+
7 Replies


P: n/a
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*******@grkjashdjkf.com> wrote in message
news:Ou**************@TK2MSFTNGP11.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

P: n/a
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****@aspalliance.com> wrote in message
news:ez**************@TK2MSFTNGP09.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*******@grkjashdjkf.com> wrote in message
news:Ou**************@TK2MSFTNGP11.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

P: n/a
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*******@grkjashdjkf.com> wrote in message
news:OR**************@TK2MSFTNGP12.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****@aspalliance.com> wrote in message
news:ez**************@TK2MSFTNGP09.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*******@grkjashdjkf.com> wrote in message
news:Ou**************@TK2MSFTNGP11.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

P: n/a
Right. This is a server control, btw. Not sure if it makes a difference. I
have the following in upload routine:
If RotateCheck.Checked = True Then
RotateImages()
End If
And in the createchildcontrols 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

P: n/a
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*******@grkjashdjkf.com> wrote in message
news:uY**************@TK2MSFTNGP12.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.Checked = True Then
RotateImages()
End If
And in the createchildcontrols 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

P: n/a
Here you go. If you need more let me know.

Private Function RotateImage(ByVal SourceImage As String, ByVal DestImage As
String) As Boolean
Dim g As System.Drawing.Image
g = System.Drawing.Image.FromFile(SourceImage)
g.RotateFlip(System.Drawing.RotateFlipType.Rotate9 0FlipNone)
g.Save(DestImage)
g.Dispose()
g = Nothing
End Function

'My call to function
If RotateCheck.Checked = True Then
RotateImage(context.Server.MapPath(_UploadDirector y & "\") + _fileName,
context.Server.MapPath(_UploadDirectory & "\") + _fileName)
End If

Protected Overrides Sub CreateChildControls()
' Add File Fields
Me.Controls.Add(New LiteralControl("<div align=""" & _align & """ "))
For I = 1 To _NumberFileFields
FileField = New HtmlControls.HtmlInputFile
RotateCheck = New CheckBox
Me.Controls.Add(New LiteralControl("<p>"))
Me.Controls.Add(FileField)
FileField.Size = _FileFieldSize
FileField.Attributes.Add("class", _FileFieldCssClass)
Me.Controls.Add(RotateCheck)
Me.Controls.Add(New LiteralControl("</p>"))
Next
' Add Submit Button
btnButton.Text = _ButtonText
btnButton.CssClass = _SubmitButtonCssClass
AddHandler btnButton.Click, AddressOf SaveImages
Me.Controls.Add(btnButton)
'Add message
Me.Controls.Add(New LiteralControl("<p class=""" & _UploadMsgCssClass &
""">"))
Me.Controls.Add(label1)
Me.Controls.Add(New LiteralControl("</div>"))
End Sub

Nov 18 '05 #7

P: n/a
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****@aspalliance.com> wrote in message
news:%2****************@TK2MSFTNGP09.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*******@grkjashdjkf.com> wrote in message
news:uY**************@TK2MSFTNGP12.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.Checked = True Then
RotateImages()
End If
And in the createchildcontrols 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 discussion thread is closed

Replies have been disabled for this discussion.