Solved

system.web.ui.htmlcontrols.htmlInputFile dpi and max length

Posted on 2004-09-23
5
303 Views
Last Modified: 2012-08-13
Hi there,

I'm trying to find a way to get the dpi and maximum length (pixels a the longest end) of an image.

Currently I can use the file control to get the size as demonstrated below, but I can't figure out how to get the other attributes. I'm using VB.Net

filectrImageFile.PostedFile.ContentLength

Thanks!
0
Comment
Question by:Gezna
  • 3
5 Comments
 
LVL 31

Expert Comment

by:seanpowell
ID: 12136830
Do you need the dpi to specify how it gets printed?
0
 
LVL 4

Expert Comment

by:itcnbwise
ID: 12140564
'## CHECK DIMENSIONS
Dim image As System.Drawing.Image = Nothing

image = System.Drawing.Image.FromStream(filectrImageFile.PostedFile.InputStream)
      Dim thisHeight As integer = image.height
      Dim thisWidth As integer = image.height

This will get you the width and height of the uploaded image.
0
 
LVL 4

Expert Comment

by:itcnbwise
ID: 12140574
I guess you could add these 2 lines to get DPI:

HorizontalResolution
0
 
LVL 4

Accepted Solution

by:
itcnbwise earned 500 total points
ID: 12140582
I guess you could add these 2 lines to get DPI:

    Dim thisHorizRes As integer = image.HorizontalResolution
    Dim thisVertRes As integer = image.VerticalResolution

(sorry for all the crazy posts - but there's a typo in the earlier one:)
Dim thisWidth As integer = image.width
0
 

Author Comment

by:Gezna
ID: 12145818
Works like a charm! thanks!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question