Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - ASP picture width
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ASP picture width

 Post Reply Post Reply Page  <12
Author
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Posted: 03 December 2003 at 1:37am

Can Javascript read width/height pixels out of a file? I though JS can do any operations with the file system.

If this is correct, that JS can do it, than it's easy to get the dimessions to ASP vars, you could fill hidden fileds in a form with the JS values, submit it, and gracefully retrieve it with ASP.

Can you post some code on the JS get picture dimenssion?

Thx.

------------------
EDIT > CORRECTION:
------------------
The above line: "I though JS can do any operations with the file system."
Should be: I though JS can't do any operations with the file system.



Edited by theSCIENTIST
Back to Top
venki View Drop Down
Groupie
Groupie


Joined: 20 April 2003
Status: Offline
Points: 40
Post Options Post Options   Thanks (0) Thanks(0)   Quote venki Quote  Post ReplyReply Direct Link To This Post Posted: 07 December 2003 at 2:23pm
Im not using any component instaled on server, Im usinp pure asp, but anyway like theSCIENTIST sayed what if I have a file saved in dir and then read its size and other.. I was thinking of JavaScript before, but its not good, I used to read picture size and store in cookie and then whit asp read cookie but that isnt good.
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: 07 December 2003 at 2:33pm
If you can use .net this should work:

Dim objBitmap As New System.drawing.Bitmap(server.mapPath("file.jpg"))
Dim width As Integer = objBitmap.Width
Dim height As Integer = objBitmap.Height
objBitmap.dispose()


Edited by Mart
Back to Top
Badaboem View Drop Down
Senior Member
Senior Member


Joined: 12 April 2002
Location: Netherlands
Status: Offline
Points: 600
Post Options Post Options   Thanks (0) Thanks(0)   Quote Badaboem Quote  Post ReplyReply Direct Link To This Post Posted: 07 December 2003 at 2:56pm

Originally posted by venki venki wrote:

Im not using any component instaled on server, Im usinp pure asp, but anyway like theSCIENTIST sayed what if I have a file saved in dir and then read its size and other.. I was thinking of JavaScript before, but its not good, I used to read picture size and store in cookie and then whit asp read cookie but that isnt good.

Javascript does work, but it uses the onsubmit method or oncheck etc. It's not supported by netscape and mac browsers (the form will never submit). I'm currently trying to resolve that issue.

Back to Top
venki View Drop Down
Groupie
Groupie


Joined: 20 April 2003
Status: Offline
Points: 40
Post Options Post Options   Thanks (0) Thanks(0)   Quote venki Quote  Post ReplyReply Direct Link To This Post Posted: 09 December 2003 at 5:22am

no, i cant use .net

Back to Top
fernan82 View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 17 November 2002
Location: United States
Status: Offline
Points: 362
Post Options Post Options   Thanks (0) Thanks(0)   Quote fernan82 Quote  Post ReplyReply Direct Link To This Post Posted: 09 December 2003 at 9:03pm
JavaScript can't get the width of the file, it can only get the width of an image displayed on a webpage, if the image is 600 pixels but has a 300 pixels width tag javascript will return 300. It is possible as somebody mentioned to display the image on a webpage without width or height tags, get the pixels with javascript and post them to an ASP page, but that's a lot of hassle.

here's how to do it with ASP:

http://www.4guysfromrolla.com/webtech/050300-1.shtml

FeRnAN
Back to Top
Necronom View Drop Down
Groupie
Groupie


Joined: 19 October 2001
Location: United States
Status: Offline
Points: 116
Post Options Post Options   Thanks (0) Thanks(0)   Quote Necronom Quote  Post ReplyReply Direct Link To This Post Posted: 23 December 2003 at 12:30am

Yes, there is a way :)

You can read the image's height, width, color dimension, and type with ASP. I spent about 3 months putting together a script that will upload, read, and resize proportinatly(sp?) on the fly. It was a bitch, but I got it to work, and it's PURE ASP...no com's...no .net.

Here's the kicker...it's so embedded in my site, that stripping it all out isn't really possible (and I'm trying to figure out a way to market this one...)

If you would like to see an example, go to http://www.BodyMod.org and click into one of the catagories. When you see a thumbnail that says there is no thumbnail, click it. Once inside, you'll see the scaled down image. Click on that to see the original.

If I get some time, I'll try to weed through my source and pull out the important pieces...

. necronom .

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 23 December 2003 at 9:32am

might want to take a stab with a function like this

i used to have perfectly working code to find height/width, but it was years ago and i cannot find it..... i gotta have it saved on CD somewhere

Contribute to the working anarchy we fondly call the Internet
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.