Vincent Pang Photography

Freelance Photographer in Malaysia for Wedding, Portrait, Events, Products, Fine Art and any photography related services

A simple file randomer

The idea is to have a simple image random at minimum processing power of course (like the one on top of the header in my blog) 

The objectives

1) support multiple folders
2) randomly get an image in the specified folder
3) hide the source of the image (bonus) 

How to call the function is like this 

<img src="/blog/imgRandom.aspx?p=1">

in which p is the path and is defined in GetPath(). You can have as many directory as possible and it will randomly pick an image.

Known problem,

for some reason the searchPattern only take in 1 parameter. Meaning only search *.jpg but cannot support *.jpg or *.gif

Attachment: imgRandom.zip (950.00 bytes) (C#)