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#)

Comments (1) -

  • evidence eliminator

    11/11/2009 1:36:53 AM |

    There are certainly a lot of details like that to take into consideration. That is a great point to bring up. I offer the thoughts above as general inspiration but clearly there are questions like the one you bring up where the most important thing will be working in honest good faith. I don?t know if best practices have emerged around things like that, but I am sure that your job is clearly identified as a fair game.

Comments are closed