Fix some issues with the image hashing
This commit is contained in:
@@ -12,8 +12,6 @@ interface Props {
|
|||||||
const category = Astro.props.category;
|
const category = Astro.props.category;
|
||||||
const settings = await getSettings();
|
const settings = await getSettings();
|
||||||
const categoryAlbums = await getCategoryAlbums(settings, category.category.url);
|
const categoryAlbums = await getCategoryAlbums(settings, category.category.url);
|
||||||
|
|
||||||
console.log(categoryAlbums);
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -59,15 +59,12 @@ export async function getAllAlbums(settings: GlobalSettings): Promise<PhotoAlbum
|
|||||||
};
|
};
|
||||||
|
|
||||||
albumRecord["photos"].forEach((photoRecord: any) => {
|
albumRecord["photos"].forEach((photoRecord: any) => {
|
||||||
const imageSize =
|
|
||||||
getImageSize(photoRecord["photo"]["width"], photoRecord["photo"]["height"], 0.8);
|
|
||||||
|
|
||||||
album.photos.push({
|
album.photos.push({
|
||||||
id: photoRecord["id"],
|
id: photoRecord["id"],
|
||||||
photo: {
|
photo: {
|
||||||
url: photoRecord["photo"]["filename_disk"],
|
url: photoRecord["photo"]["filename_disk"],
|
||||||
width: imageSize.width,
|
width: photoRecord["photo"]["width"],
|
||||||
height: imageSize.height
|
height: photoRecord["photo"]["height"]
|
||||||
},
|
},
|
||||||
text: photoRecord["text"]
|
text: photoRecord["text"]
|
||||||
});
|
});
|
||||||
@@ -145,15 +142,12 @@ export async function getAlbum(settings: GlobalSettings, route: string): Promise
|
|||||||
};
|
};
|
||||||
|
|
||||||
albumRecord["photos"].forEach((photoRecord: any) => {
|
albumRecord["photos"].forEach((photoRecord: any) => {
|
||||||
const imageSize =
|
|
||||||
getImageSize(photoRecord["photo"]["width"], photoRecord["photo"]["height"], 0.8);
|
|
||||||
|
|
||||||
album.photos.push({
|
album.photos.push({
|
||||||
id: photoRecord["id"],
|
id: photoRecord["id"],
|
||||||
photo: {
|
photo: {
|
||||||
url: photoRecord["photo"]["filename_disk"],
|
url: photoRecord["photo"]["filename_disk"],
|
||||||
width: imageSize.width,
|
width: photoRecord["photo"]["width"],
|
||||||
height: imageSize.height
|
height: photoRecord["photo"]["height"]
|
||||||
},
|
},
|
||||||
text: photoRecord["text"]
|
text: photoRecord["text"]
|
||||||
});
|
});
|
||||||
@@ -228,15 +222,12 @@ export async function getLastAlbums(amount: number) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
albumRecord["photos"].forEach((photoRecord: any) => {
|
albumRecord["photos"].forEach((photoRecord: any) => {
|
||||||
const imageSize =
|
|
||||||
getImageSize(photoRecord["photo"]["width"], photoRecord["photo"]["height"], 0.8);
|
|
||||||
|
|
||||||
album.photos.push({
|
album.photos.push({
|
||||||
id: photoRecord["id"],
|
id: photoRecord["id"],
|
||||||
photo: {
|
photo: {
|
||||||
url: photoRecord["photo"]["filename_disk"],
|
url: photoRecord["photo"]["filename_disk"],
|
||||||
width: imageSize.width,
|
width: photoRecord["photo"]["width"],
|
||||||
height: imageSize.height
|
height: photoRecord["photo"]["height"]
|
||||||
},
|
},
|
||||||
text: photoRecord["text"]
|
text: photoRecord["text"]
|
||||||
});
|
});
|
||||||
@@ -323,8 +314,8 @@ export async function getCategoryAlbums(settings: GlobalSettings, route: string)
|
|||||||
id: photoRecord["id"],
|
id: photoRecord["id"],
|
||||||
photo: {
|
photo: {
|
||||||
url: photoRecord["photo"]["filename_disk"],
|
url: photoRecord["photo"]["filename_disk"],
|
||||||
width: imageSize.width,
|
width: photoRecord["photo"]["width"],
|
||||||
height: imageSize.height
|
height: photoRecord["photo"]["height"]
|
||||||
},
|
},
|
||||||
text: photoRecord["text"]
|
text: photoRecord["text"]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export async function getPhotoFromHash(albumUrl: string, hash: string): Promise<
|
|||||||
* I have decided to not put the getImageSize here, it can mess up the
|
* I have decided to not put the getImageSize here, it can mess up the
|
||||||
* hashing, or anything else. It seems smarter to do this in the photo's and galleries.
|
* hashing, or anything else. It seems smarter to do this in the photo's and galleries.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const hashObject = md5(JSON.stringify({
|
const hashObject = md5(JSON.stringify({
|
||||||
id: photo.id,
|
id: photo.id,
|
||||||
url: photo.photo.filename_disk,
|
url: photo.photo.filename_disk,
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ if (page === null || page.page === null || !page.page.exists) {
|
|||||||
}
|
}
|
||||||
}}}>
|
}}}>
|
||||||
<Fragment slot="content">
|
<Fragment slot="content">
|
||||||
<div>Photo</div>
|
<div>{page.page.id}</div>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
</WebpageLayout>
|
</WebpageLayout>
|
||||||
) }
|
) }
|
||||||
|
|||||||
Reference in New Issue
Block a user