I have lot of images to show on my site. I want to know how can i do this using one file something like viewer.php so that i can point link to example.com/viewer.php?=/images/myfile.jpg
You can use the GET methods of PHP. If you use a url such as: example.com/viewer.php?imagePath=/images/myfile.jpg Then the file "viewer.php" will be passed the value "/images/myfile.jpg" in the GET variable "imagePath". To access this in your PHP code, you need to use $_GET['imagePath']. _GET is an array containing all of the GET variables passed in to the page. So to include the image in your page, you would do something like: echo "<img src='$_GET[imagePath]' />"; PHP: One thing to think about with using GET is that anyone using your site can type anything they want as a URL, so you might want to do some validation on your GET variables before using them, to avoid code injection attacks.