Link to home
Start Free TrialLog in
Avatar of wilkersons
wilkersons

asked on

Slideshow using VB.NET & ASP.NET

Guys,

I am new to ASP.NET & VB.NET. I have a question with regards to slideshows. How can the contents of a folder be dynamically displayed as thumbnails on a website?
 
Thanks in advance
Avatar of Gitcho
Gitcho

There's a number of different ways to do it.  

If you have your all your thumbnails in the same folder, you can read them from the directory into an array, and output them on your page.

If you need to dynamically resize images to thumbnails, here's a good article on it here : http://aspnet.4guysfromrolla.com/articles/081303-1.aspx


There's an article to show you how to read images from a directory & display them in a slideshow here : http://aspnet.4guysfromrolla.com/articles/070704-1.aspx

Hope that helps ...
Avatar of wilkersons

ASKER

Gitcho,,

thanks. But some how i am not able to run these programs ...i need to do some reading about the above mentioned programs..

will get back soon
Avatar of YZlat
Const IMAGE_DIRECTORY As String = "images/"
        Dim pics() As String
        Dim s As String, html As String

        Dim i As Integer
        Dim objFile As IO.FileInfo

        pics = IO.Directory.GetFiles(IMAGE_DIRECTORY)

        For i = 0 To pics.Length - 1
            objFile = New IO.FileInfo(pics(i))
        Next


       
        dlPictures.DataSource = pics
        dlPictures.DataBind()
YZlat can you pl explain the code. How do I use this code?
ASKER CERTIFIED SOLUTION
Avatar of Gitcho
Gitcho

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
wilkersons the above code is perfect for what you are trying to accomplish, when you get familiar with this code and you prefer to give it some more dynamic look generate page like his: http://www.frozendev.com/temp/image.asp

all you have to do is give image array proper definition (image source, x-position, y-position, width and height.)
I'm sure it will look more decent then example on 4guysfromrolla...

images[0]=[];
(animate)?images[0][0]=new Image():images[0][0]=[];
(animate)?images[0][0].src="0.gif":images[0][0]="0.gif";
(animate)?images[0][1]=new Image():images[0][1]=[];
(animate)?images[0][1].src="1.gif":images[0][1]="1.gif";
(animate)?images[0][2]=new Image():images[0][2]=[];
(animate)?images[0][2].src="2.gif":images[0][2]="2.gif";

(animate)?images[0][3]=new Image():images[0][0]=[];
(animate)?images[0][3].src="3.gif":images[0][0]="3.gif";
(animate)?images[0][4]=new Image():images[0][1]=[];
(animate)?images[0][4].src="4.gif":images[0][1]="4.gif";
(animate)?images[0][5]=new Image():images[0][2]=[];
(animate)?images[0][5].src="5.gif":images[0][2]="5.gif";

(animate)?images[0][6]=new Image():images[0][6]=[];
(animate)?images[0][6].src="6.gif":images[0][6]="6.gif";
(animate)?images[0][7]=new Image():images[0][7]=[];
(animate)?images[0][7].src="7.gif":images[0][7]="7.gif";
(animate)?images[0][8]=new Image():images[0][8]=[];
(animate)?images[0][8].src="8.gif":images[0][8]="8.gif";

(animate)?images[0][9]=new Image():images[0][9]=[];
(animate)?images[0][9].src="10.gif":images[0][9]="10.gif";
(animate)?images[0][10]=new Image():images[0][10]=[];
(animate)?images[0][10].src="11.gif":images[0][10]="11.gif";


images[1]=0;        // x
images[2]=0;        // y
images[3]=200;      // w
images[4]=150;      // h
images[5]="img1";   // name
images[6]=0;        // sequence


the full example of this source code is availabe from that path I posted above this sectiom...

cheers!
 dave
wlkersons:

      ''declare your directory(where images are stored)
      Const IMAGE_DIRECTORY As String = "images/"

      ''declare an array of strings
        Dim pics() As String

        Dim s As String, html As String
        Dim i As Integer
        Dim objFile As IO.FileInfo

      ''fill an array of strings with image file names
        pics = IO.Directory.GetFiles(IMAGE_DIRECTORY)

      ''loop through the data in a array and read it into file object
        For i = 0 To pics.Length - 1
            objFile = New IO.FileInfo(pics(i))
        Next


       
        dlPictures.DataSource = pics
        dlPictures.DataBind()
YZat, zdarova zemliak vi gde jiviote..?
Thanks guys for all your answers. Got it working. I will give this one to Gitcho.