little confused with this line. maybe it should be rewritten as 
if( comment.getHasImage() == true && prev_has_image == false)
both are basically the same line but this make more sense to me