piwigo把图片页的图片换成原图

piwigo的图片页默认输出的是压缩过的图,尺寸会小点,想换成原图的,找到主题目录下的 template 目录下的 picture_content.tpl 文件,换成下面的内容就行了

<script type="text/javascript">

	let url = '{$current.selected_derivative->get_url()}'

	if (url.substr(0,5) === '_data' || url.substr(0,5) === 'i.php') {

	let size = url.substring(url.lastIndexOf('.')-3, url.lastIndexOf('.'))

	let originLink

	if (size === '-me' || size === '-la' || size === '-xs'){

		// get original address

		originLink = url.replace('_data\/i\/','').replace('i.php?\/', '').replace(size, '')

	}

	document.write("<img src='" + originLink + "' alt='{$ALT_IMG}' />")

	} else {

		document.write("<img src='" + url + "' alt='{$ALT_IMG}' />")
	}

</script>