Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Image manipulation
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Image manipulation

 Post Reply Post Reply Page  <12
Author
Mattblack View Drop Down
Groupie
Groupie
Avatar

Joined: 21 January 2003
Location: United Kingdom
Status: Offline
Points: 139
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mattblack Quote  Post ReplyReply Direct Link To This Post Posted: 14 November 2004 at 11:17am

brilliant!  You're a genious!!!  :-)

Thank you.

Back to Top
Mattblack View Drop Down
Groupie
Groupie
Avatar

Joined: 21 January 2003
Location: United Kingdom
Status: Offline
Points: 139
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mattblack Quote  Post ReplyReply Direct Link To This Post Posted: 14 November 2004 at 11:19am
even makes it a smaller file size!  Im well chuffed now
Back to Top
jchonparadise View Drop Down
Newbie
Newbie


Joined: 31 May 2006
Location: United States
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote jchonparadise Quote  Post ReplyReply Direct Link To This Post Posted: 21 June 2006 at 10:26pm
I realize this is a really old thread, but I just came upon it.
 
I get the following error when i implement the code:
 

Parameter is not valid.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Parameter is not valid.

Source Error:

Line 6:  Response.ContentType = "Image/Jpeg"
Line 7:  
Line 8:  Dim SourceImage As New Bitmap(Server.MapPath(Request.QueryString("source")))
Line 9:  
Line 10: Dim NewWidth As Integer = SourceImage.Width
 
Stack Trace:

[ArgumentException: Parameter is not valid.]
   System.Drawing.Bitmap..ctor(String filename) +375381
   ASP.thumbnail_aspx.Page_Load() in [REMOVED because I'm paranoid]\thumbnail.aspx:8
   System.Web.Util.CalliHelper.ArglessFunctionCaller(IntPtr fp, Object o) +5
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +781855
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061

Help?


Edited by jchonparadise - 21 June 2006 at 10:34pm
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 26 June 2006 at 7:04pm
Can you post the entire source to thumbnail.aspx, including any modifications?
As far as i can tell the original code that i posted should work fine, also what parameters are you providing the page with?
You have to remember that the source parameter should be a virtual path starting from the directory that the script is in, it's then translated to a physical path.
Back to Top
jchonparadise View Drop Down
Newbie
Newbie


Joined: 31 May 2006
Location: United States
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote jchonparadise Quote  Post ReplyReply Direct Link To This Post Posted: 26 June 2006 at 7:14pm
Thanks for the help - here's the source (nothing was changed from what you posted):

<%@ Page Language="vb" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<script runat="server">
Public Sub Page_Load
Response.ContentType = "Image/Jpeg"
Dim SourceImage As New Bitmap(Server.MapPath(Request.QueryString("source")))
Dim NewWidth As Integer = SourceImage.Width
Dim NewHeight As Integer = SourceImage.Height
Do Until NewWidth < 100 And NewHeight < 100
NewWidth = NewWidth / 2
NewHeight = NewHeight / 2
Loop
Dim Thumbnail As Bitmap = SourceImage.GetThumbnailImage(NewWidth, NewHeight, Nothing, IntPtr.Zero)
Thumbnail.Save(Response.OutputStream, ImageFormat.Jpeg)
Thumbnail.Dispose()
SourceImage.Dispose()
End Sub
</script>
 
And I did point the source to the virtual path (similar to your example: thumbnail.aspx?source=images/test.jpg)


Edited by jchonparadise - 26 June 2006 at 9:51pm
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.