You need to run updatedb as root.
You can use "find" instead of locate. The main difference is that locate is intended to be much faster via the indexing database it uses but you cant locate something unless the database is updated. find will do an active search.
Code:
find /var/www/html -type f -name *.jpg
Would find all .jpg files in your /var/www/html and subdirectories. See the ss64.com/bash/find.html page or the manual page for find in the os.