Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Image Size in ASP.NET VB

Posted on 2004-10-29
3
Medium Priority
?
352 Views
Last Modified: 2010-04-06
I am using this code to show Image File Size and Dimension information.

<%@ Page Language="VB" aspcompat="true" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
<MM:DataSet
id="PI_SML_Image"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_connfujitsu") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_connfujitsu") %>'
CommandText='<%# "SELECT *  FROM dbo.Product_Images  WHERE PI_ID = 11" %>'
Debug="true"
></MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />


<script runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
  Dim info

  info = Server.CreateObject("UnitedBinary.AutoImageInfo")
  info.ReadHeader("C:\Inetpub\wwwroot\fujitsu\images\productimages\1300LT-viewG1-LT.jpg")

  Format.Text = info.ImageFileFormat
  FileSize.Text = info.FileSize
  PixelWidth.Text = info.ImageWidth
  PixelHeight.Text = info.ImageHeight
End Sub
</script>
<HTML>
   <HEAD>
   </HEAD>
   <BODY>
<asp:Label ID="Format" runat="server"></asp:Label><br>
<asp:Label ID="FileSize" runat="server"></asp:Label> <br>
<asp:Label ID="PixelWidth" runat="server"></asp:Label> <br>
<asp:Label ID="PixelHeight" runat="server"></asp:Label>  
</BODY>
</HTML>

I am working in Dreamweaver MX 2004 and server technology is ASP.NET VB

In the above code i am not able to use a dataset item in  info.ReadHeader("C:\Inetpub\wwwroot\fujitsu\images\productimages\1300LT-viewG1-LT.jpg"). Dataset is called PI_SML_Image which contains File_Name information.

Please note: UnitedBinary.AutoImageInfo is a com component that I installed in my computer and it is particularly to show image file size in asp.net pages.

I need to show file size and pixel dimensions of an image whose file_name is in the database and image resides in the folder. I have checked quite a few tutorials online which explains how to get that info using server.MapPath but that shows the images of entire directory. I just need to show info on one image whose file_name is in a table of a sql database and it filters the table on the basis of a Request.QueryString("PI_ID").

I am not really tied up with using the above code so anything totally different is acceptable as long as it works in asp.net vb.

I am using this website for the first time so dont know about the service but hoping to get a solution.

Please help...

Thanks
Manish
0
Comment
Question by:crmanish
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Accepted Solution

by:
riyasjef earned 2000 total points
ID: 12453358
Hi

Try this

Dim img as System.Drawing.Image = System.Drawing.Image.FromFile("test.gif")
     
imgHeight = img.Height
imgWidth = img.Width

See at

http://aspnet.4guysfromrolla.com/articles/012203-1.2.aspx

Also u can use bitmap object for image manipulation..

See this

http://www.codeproject.com/aspnet/ASPImaging1.asp

RJ  
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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

597 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