added permalink to attachment page in images function