This commit is contained in:
qwertyforce 2020-09-23 15:03:57 +03:00
parent 82c396f509
commit a7c1ebdfea
3 changed files with 3 additions and 3 deletions

View File

@ -86,7 +86,7 @@ export async function getStaticProps(context: any) {
if (context.params.page) {
const images = (await db_ops.image_ops.get_all_images()).reverse()
const page = parseInt(context.params.page)
if (page <= Math.ceil(images.length / images_on_page)) {
if (page >= 1 && page <= Math.ceil(images.length / images_on_page)) {
for (let i = (page - 1) * images_on_page; (i < (page) * images_on_page) && (i < images.length); i++) {
photos.push({
src: `/webp_images/${images[i].id}.webp`,

View File

@ -60,7 +60,7 @@ export async function getServerSideProps(context: any) {
if (page <= Math.ceil(images.length / images_on_page)) {
for (let i = (page - 1) * images_on_page; (i < (page) * images_on_page) && (i < images.length); i++) {
photos.push({
src: `/images/${images[i].id}.${images[i].file_ext}`,
src: `/webp_images/${images[i].id}.webp`,
key: `/image/${images[i].id}`,
width: images[i].width,
height: images[i].height

View File

@ -86,7 +86,7 @@ export async function getStaticProps(context: any) {
if (context.params.page) {
const images = (await db_ops.image_ops.get_all_images()).sort((a, b) => b.wilson_score - a.wilson_score)
const page = parseInt(context.params.page)
if (page <= Math.ceil(images.length / images_on_page)) {
if (page >= 1 && page <= Math.ceil(images.length / images_on_page)) {
for (let i = (page - 1) * images_on_page; (i < (page) * images_on_page) && (i < images.length); i++) {
photos.push({
src: `/webp_images/${images[i].id}.webp`,