Solved

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

Posted on 2004-09-23
5
302 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ebay style="image-orientation: 90deg;" 2 38
Width of Page is Affecting Side Menu 6 25
Change Background Color of Website 5 17
Little bit of help styling my heading 3 19
This article discusses four methods for overlaying images in a container on a web page
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

773 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