Since you've got a belongs_to
relationship on your Image
model, you should just be able to use listing_id
as part of the paperclip config:
has_attached_file :photo,
:styles => { :medium => "300x300>", :thumb => "100x100>" },
:url => "system/photos/:listing_id/:id"