My client have created a script in php+mysql that saves images directly in the database and every images has url like this: www.example.com/image.php?id=421
In your
Just because it can be done, doesn't mean it should be.
I always store meta data about the images (filename, location, other attributes) in the database, and store images externally in the file system. There is very little benefit, imo, of actually storing images in an SQL database. Once they are in there, they are very inconvenient to use.