I have created a Web-Gallery where photos are uploaded,can be tagged with one or more tags,and can be viewed by Users/Tags/Likes/Date of Upload/Title.

I am to create a navigation like "Prev" and "Next". But what category should I choose to implement this and how ?

What I thought of was get the tags for a photo,arrange them in lexicographical order and get the next image in the tag which comes first. But that won't work,because different images have different tags.

The image URL on my system is like <sitename>/view/<MD5 hash from the file contents> e.g. http://my.gallery.net/view/f8892e79d5bef3214e9d74d9ae5df35e

So,any ideas ? Thankyou.

implement some kind of ordering option, and next/prev on that
allow the user to choose order

"Allow the user to choose order" - How ?

Look,on any page,I have simply links to images,when does the user get to choose the order by which (s)he wants to browse ? I already provide the link to the uploader's profile in the photo,and the tags.

How ?

By having dropdowns like: "Sort by <criteria> <asc/desc>"

And then use jQuery/AJAX to re-order the results. How you go about doing that depends on your HTML.

Or you could use a server side language, but you cant have any effects or quick re-organising. But far more useful if you've got lots of items to search through.

You can do here
1. is allow the user to enter the tag name and access the all the image based on the tag from the database and paste in xml or add it in table for the image
image should displayed in gallery from this table only for next button increc the row pre button the dec the row