Updated this so that I'm using separate conditionals to evaluate the options[:src] and options[:alt] values. The nested if in the options[:src] conditional is ugly, but I can't figure out a more concise way to write this.