Create an Image Gallery with FILES web directory and names of files in SQL server

Discussion in 'ASP .Net' started by news.microsoft.com, Feb 26, 2005.

  1. Hello and first of all thank you for your time.

    I am currently developing an ASP.net web page, which has data stored in SQL
    Server. It is a web page for a State Agent and my problem is:

    I need to create an image gallery (with some kind of slide Next and Previous
    picture) of the flat you are interested to see.

    The pictures are stored on a directory of the web.

    The names of the pictures are stored, also, on a table in SQL which is
    FlatPhotos, and of course I have the fields PhotoID, FlatID, on
    one-to-multiple basis, as there are around 10 or 14 photos for each flat.

    I have already designed the page for the one-only-flat that you are
    interested to see, and everything is working fine, except for the picture
    gallery.

    I have been working and trying to search for info on the web for more than 8
    hours now, an I decided to contact you.

    The final design is like this

    <=Previous Button
    Picture 1
    Picture 2
    Picture 3
    Picture 4
    Picture 5
    Next button =>














    Main picture (or the picture you click on in a bigger size)












    Text info of the flat




    Can you help me with this, please?

    Thanks again and sorry for the inconvenience.

    Albert Lens

    WIN SOLUTIONS SL
     
    news.microsoft.com, Feb 26, 2005
    #1
    1. Advertising

  2. news.microsoft.com

    fd123456 Guest

    Hi Albert,

    I would use the query string to discriminate between pictures.

    Say your page is called "FlatCheck". Upon Page_Load, check for the
    number of pictures that exist for that particular flat. Say, there are
    8 of them.

    Create (in a loop) 8 HyperLinks, each being directed to that same
    page, with "?Pic=" + the number at the end, and add them to a
    placeholder on your page. Example :

    for (int n = 0; n < NumberOfPics; n++)
    {
    HyperLink hl = new Hyperlink;
    hl.Text = "Picture " + n.ToString();
    hl.NavigateUrl = "FlatCheck.aspx?Pic=" + n.ToString();
    myPlaceHolder.Controls.Add(hl);
    }

    Create a variable to hold the number of the picture to be shown :

    int DesiredPic = 0;

    Next, check the Query string :

    string s = Request.QueryString["Pic"]
    if ( (s != null) & (s.Length>0) )
    DesiredPic = Convert.ToInt32(s); // you should trap errors and check
    for consistency here

    Then, get your picture name from the db (pseudo code here, as I don't
    know how your db is layed out) :

    string PicPath = new myDB().GetPicturePath(FlatNumber,DesiredPic);

    Finally, assign the path you just got to the Image on the page:

    myImage.ImageURL = Server.MapPath("") + PicPath;

    And you should be good to go.

    To open the picture in a separate window, you must use Javascript. If
    you want that window to be the exact size of the picture, you have to
    know the size of the picture beforehand (either load if first - time
    and processor costly - or have it's size written in the db - not
    always possible if you don't own the db). Anyway, there are lots of
    scripts out there to do this. Look for "javascript picture
    window.open" in Google.

    HTH,

    Michel


    "news.microsoft.com" <> wrote in message news:<>...
    > Hello and first of all thank you for your time.
    >
    > I am currently developing an ASP.net web page, which has data stored in SQL
    > Server. It is a web page for a State Agent and my problem is:
    >
    > I need to create an image gallery (with some kind of slide Next and Previous
    > picture) of the flat you are interested to see.
    >
    > The pictures are stored on a directory of the web.
    >
    > The names of the pictures are stored, also, on a table in SQL which is
    > FlatPhotos, and of course I have the fields PhotoID, FlatID, on
    > one-to-multiple basis, as there are around 10 or 14 photos for each flat.
    >
    > I have already designed the page for the one-only-flat that you are
    > interested to see, and everything is working fine, except for the picture
    > gallery.
    >
    > I have been working and trying to search for info on the web for more than 8
    > hours now, an I decided to contact you.
    >
    > The final design is like this
    >
    > <=Previous Button
    > Picture 1
    > Picture 2
    > Picture 3
    > Picture 4
    > Picture 5
    > Next button =>
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > Main picture (or the picture you click on in a bigger size)
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > Text info of the flat
    >
    >
    >
    >
    > Can you help me with this, please?
    >
    > Thanks again and sorry for the inconvenience.
    >
    > Albert Lens
    >
    > WIN SOLUTIONS SL
     
    fd123456, Feb 27, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QmFzIEhlbmRyaWtz?=

    Directory and files names in temporary asp.net directory

    =?Utf-8?B?QmFzIEhlbmRyaWtz?=, Jan 28, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    889
    Juan T. Llibre
    Jan 31, 2005
  2. fBechmann
    Replies:
    0
    Views:
    417
    fBechmann
    Jun 10, 2004
  3. www.web20developers.com
    Replies:
    0
    Views:
    599
    www.web20developers.com
    Oct 12, 2006
  4. Christophe
    Replies:
    2
    Views:
    94
    Christophe
    Apr 23, 2005
  5. iMath
    Replies:
    8
    Views:
    317
    emile
    Nov 13, 2012
Loading...

Share This Page