Exclude invalid_referrer directory

I use the following code block to redirect invalid referrers back to the
homepage when someone attempts to view an image directly on my Wordpress

I would like to be able to use /var/www/blog/wp-content in the code
block below for the invalid referrers, and have another code block such
as /var/www/otherimages that does not redirect or block any referrers.
/var/www/otherimages could be viewed by anyone even directly. How would
I write this second code block?

location ~ .(jpg|jpeg|gif|png|flv|mp3|mpg|mpeg)$ {
root /var/www/blog;
expires max;
valid_referers blocked ~.google.;
if ($invalid_referer) {
rewrite ^(.*)$ http://www.mydomain.com/;