Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 4th, 2004, 02:14 AM
Authorized User
 
Join Date: Oct 2003
Location: , , .
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
Default datalist and images(get width and height)

Hi,

I have a datalist which receives images from the database. I want to open the pictures in a new window. The window must open according to the image's width and size (each picture has different dimensions).
The user clicks an image in the datalist and a new window open. However, I am not sure how to define the width and height for each picture.

Thanks

My code:

<code>
ASPX:
<script language=javascript>
function changeSize(image)
{
var width=images.width;
var height=images.height;
imPrev = window.open(image.src, 'imagePreview', 'toolbar=0,scrollbars=0,location=0,statusbar=0,men ubar=0,resizable=0,width='+width,height='+height,l eft = 100,top = 100');

}

</SCRIPT>
<asp:datalist id="ImageList" runat="server" RepeatDirection="Horizontal" RepeatColumns="5">
<ItemTemplate>
<img src="ModelImages/<%=classify_id%>/<%=worker_id%>/<%#Container.DataItem%>?p=<%=DateTime.Now%>" width=50 height=60 hspace=5 border="0" onClick="changeSize(this);" style="cursor:hand;">
</ItemTemplate>
</asp:datalist>

CODEBEHIND:
 Function fillImgList() 'FILL DATALIST WITH IMAGES BUT HOW DO I GET THE SIZE OF THE IMAGE TO USE IN JAVASCRIPT?

        ' Obtain Product Details
        Dim Models As Components.WorkersDB = New Components.WorkersDB
        Dim mydr As SqlDataReader = Models.GetWorkerDetails(Worker_Id)
        mydr.Read()

        PicAr = New ArrayList

        Dim i As Integer
        For i = 1 To 6
            'If there is an image in db
            If mydr("Image" & i.ToString) <> "" Then
                Dim imgId As String = mydr("Image" & i.ToString)

                Dim imgExt As String

                If imgId <> "" Then
                    PicAr.Add(imgId)
                End If
            End If
        Next

        ImageList.DataSource = PicAr
        ImageList.DataBind()

    End Function
</code>


Reply With Quote
  #2 (permalink)  
Old August 4th, 2004, 08:24 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

For each image that you are going to display, you can open the image using the System.Drawing classes. You can create a new System.Drawing.Image from the file, then get the image's characteristics (dimensions, color depth, all sorts of things). Be sure to resolve the absolute path of the image before you try to open it.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get image height and width Dj Kat Javascript How-To 10 June 4th, 2009 01:49 PM
Chapter 2: width/height mcleod BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 5 May 24th, 2007 09:55 PM
get the height and width of an image with js crmpicco Javascript How-To 1 August 30th, 2006 11:26 PM
how can I get width/height of a picture? keyvanjan Classic ASP Basics 2 May 29th, 2006 07:29 AM
Height and Width? venkatesh_anmca Beginning VB 6 0 January 31st, 2005 05:13 AM



All times are GMT -4. The time now is 12:42 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.