Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 16th, 2006, 07:13 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 45th Plane (27000 - 27499 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,266 Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 6 Days 12 h 6 m 3 sec
Reputation Power: 1791
Post ShadowResizer - image resize on the fly (classic ASP)

note: newer version is available in this thread. I'm leaving this
thread to serve as different approach to the same issue.


Attached is little C# command line application which can resize
pictures using smart resize.
Using the application requires .NET framework 1.1 or later to be
installed on the computer.
The application can be used with classic ASP too, with the
WScript.Shell component - note that for this to work, you should
have .NET framework installed on the server, plus permissions to
execute command line applications.
No installation is required - just copy the file to the same location
as your ASP file and see the attached sample code for example
of using it. sample picture is given as well.
Sample code is below as well:
Code:
--TestResize.asp
<% Option Explicit %>
<%
'-----------------------------------------
'constants
Const RESIZER_FILE_NAME="ShadowResizer.exe"
Const ORIGINAL_IMAGE_NAME="sample_picture.jpg"
Const THUMB_IMAGE_NAME="sample_picture_thumb.jpg"
'-----------------------------------------

'-----------------------------------------
'methods
Sub Resize()
	Dim objShell, strCommand
	Set objShell = Server.CreateObject("WScript.Shell")
	strCommand = Server.MapPath(RESIZER_FILE_NAME) & " " & Server.MapPath(ORIGINAL_IMAGE_NAME)
	If IsNumeric(Request("width")) Then
		strCommand = strCommand & " -width=" & Request("width")
	End If
	If IsNumeric(Request("height")) Then
		strCommand = strCommand & " -height=" & Request("height")
	End If
	strCommand = strCommand & " -saveas=" & Server.MapPath(THUMB_IMAGE_NAME)
	objShell.Run strCommand, 0, True
	Set objShell=Nothing
End Sub
'-----------------------------------------

'-----------------------------------------
'main
If Request("action")="1" Then
	Call Resize()
End If
'-----------------------------------------
%>
<html>
<head>
<title>Shadow Resizer Example</title>
</head>
<body>
Original image: <img src="<%=ORIGINAL_IMAGE_NAME%>" /><br />
<% If Request("action")="1" Then %>
New image: <img src="<%=THUMB_IMAGE_NAME%>" /><br />
<% End If %>
<form action="<%=Request.ServerVariables("Script_Name")%>">
<input type="hidden" name="action" value="1" />
Width: <input type="text" name="width" value="<%=Request("width")%>" />(empty to smart resize by height)<br />
Height: <input type="text" name="height" value="<%=Request("height")%>" />(empty to smart resize by width)<br />
<button type="submit">Resize</button>
</form>
</body>
</html>

as you can see, the sample page take picture and let you decide
its new height and/or width - the resulting picture is true
thumbnail with new dimensions.
Comments on this post
MARKEDAGAIN agrees: thx shadow
Attached Files
File Type: zip ShadowResizer.zip (6.9 KB, 3782 views)

Last edited by Shadow Wizard : February 4th, 2007 at 01:23 AM.

Reply With Quote
  #2  
Old April 22nd, 2006, 02:30 PM
swremick swremick is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 1 swremick User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 8 sec
Reputation Power: 0
Exclamation Thanks, but need help!

Hi Shadow, thanks for the great code. I seem to recieve an error from the exe file. I have it installed on my locall IIS machine, and I think I have execute rights on the folder it is in. Maybe I have granted incorrect permissions?

Here is the error, it occurs after I enter demension and I cick resize:
Application has generated an exception that could not be handled.
Process id=0x678 (1656), Thread id=0x15cc (5580).

Any ideas on what the problem could be? I do have .Net Framework installed on my machine.

Thanks

Reply With Quote
  #3  
Old April 23rd, 2006, 01:53 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 45th Plane (27000 - 27499 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,266 Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 6 Days 12 h 6 m 3 sec
Reputation Power: 1791
sounds like you don't have the .NET framework, or maybe you have old version.
if you do have the new version, try executing the application from the command line:
Start --> Run --> Cmd --> cd C:\Inetpub\wwwroot --> ShadowResizer.exe ...
and hopefully more meaningful error message will appear in the console.

Reply With Quote
  #4  
Old April 28th, 2006, 10:56 PM
chen chen is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 154 chen User rank is Private First Class (20 - 50 Reputation Level)chen User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 3 h 3 m 33 sec
Reputation Power: 4
its very good.

but can it do like in windows Thumbnails function?

i means is in My Pictures Folder Function.

somethings like this

before
[img]
http://img.photobucket.com/albums/v430/Chen/new.gif
[/img]

after
[img]
http://img.photobucket.com/albums/v430/Chen/newthumd.gif
[/img]
Thanks.

Reply With Quote
  #5  
Old April 30th, 2006, 01:21 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 45th Plane (27000 - 27499 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,266 Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 6 Days 12 h 6 m 3 sec
Reputation Power: 1791
no idea what you mean, sorry.

Reply With Quote
  #6  
Old April 30th, 2006, 05:24 AM
chen chen is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 154 chen User rank is Private First Class (20 - 50 Reputation Level)chen User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 3 h 3 m 33 sec
Reputation Power: 4
i mean is

before the image is like this
maybe this image is 190X20

after i thumbnail the image it will become like this

it become 128X128

that mean is after i resize the image it not lose shape.
hope you understand my question

thanks

Reply With Quote
  #7  
Old April 30th, 2006, 05:30 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 45th Plane (27000 - 27499 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,266 Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 6 Days 12 h 6 m 3 sec
Reputation Power: 1791
if you force both width and height, it would "lose shape". nothing can fix that.
this image you posted is the same image, only in the second you put white
background around it. I have no clue what you did by that.

Reply With Quote
  #8  
Old April 30th, 2006, 12:08 PM
chen chen is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 154 chen User rank is Private First Class (20 - 50 Reputation Level)chen User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 3 h 3 m 33 sec
Reputation Power: 4
i also dun know how the Windows XP do it


Reply With Quote
  #9  
Old April 30th, 2006, 06:13 PM
baseballdude_'s Avatar
baseballdude_ baseballdude_ is offline
Expert Learner
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2005
Location: Wisconsin
Posts: 1,879 baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 22104 Folding Title: Starter FolderFolding Points: 22104 Folding Title: Starter Folder
Time spent in forums: 1 Week 5 Days 12 h 1 m
Reputation Power: 62
Send a message via AIM to baseballdude_ Send a message via MSN to baseballdude_ Send a message via Yahoo to baseballdude_ Send a message via Google Talk to baseballdude_
That's not the acutal image. The entire square is a placeholder, with an image inside it.

Reply With Quote
  #10  
Old April 30th, 2006, 09:47 PM
chen chen is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 154 chen User rank is Private First Class (20 - 50 Reputation Level)chen User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 3 h 3 m 33 sec
Reputation Power: 4
Quote:
Originally Posted by baseballdude_
That's not the acutal image. The entire square is a placeholder, with an image inside it.


Yes, i want the thing like this

Reply With Quote
  #11  
Old April 30th, 2006, 10:29 PM
baseballdude_'s Avatar
baseballdude_ baseballdude_ is offline
Expert Learner
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2005
Location: Wisconsin
Posts: 1,879 baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 22104 Folding Title: Starter FolderFolding Points: 22104 Folding Title: Starter Folder
Time spent in forums: 1 Week 5 Days 12 h 1 m
Reputation Power: 62
Send a message via AIM to baseballdude_ Send a message via MSN to baseballdude_ Send a message via Yahoo to baseballdude_ Send a message via Google Talk to baseballdude_
Then just place a box around the image.

Reply With Quote
  #12  
Old April 30th, 2006, 11:22 PM
chen chen is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 154 chen User rank is Private First Class (20 - 50 Reputation Level)chen User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 3 h 3 m 33 sec
Reputation Power: 4
Quote:
Originally Posted by baseballdude_
Then just place a box around the image.


yes i know.

problem is how i resize the image and not lose the shape?

Thanks

Reply With Quote
  #13  
Old May 1st, 2006, 02:36 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 45th Plane (27000 - 27499 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,266