Compare commits

..

15 Commits

Author SHA1 Message Date
3de87809bb GenericTable: prevent passing NULL to strtotime 2022-07-14 16:45:32 +02:00
c763967463 Prevent current page from being 0 if no items are present 2022-07-14 16:45:17 +02:00
6369187eb7 Add double-density thumbnails to albums and photo pages 2022-07-08 23:53:28 +02:00
b3808144ca Address deprecation notices for certain function signatures 2022-07-08 23:52:03 +02:00
d8858c78bb Thumbnails: crop from original size if 2x is unavailable 2022-07-07 14:54:00 +02:00
c0d69f7205 Do not delete thumbnail queue when replacing an asset
Thumbnails are normally created on demand, e.g. when processing the format codes in a post's body text.
Normally, the temporary URL is only used once to generate thumbnails ad-hoc. However, when cache is
enabled, a reference to the asset may be used in a cached version of a formatted body text, skipping
the normal thumbnail generation routine.

When an asset is replaced, currently, all thumbnails are removed and references to them are removed
from the database. In case the asset is still referenced in a cached formatted body text, this could lead
to an error when requesting the thumbnail, as the thumbnail request is no longer present in the system.

As we do not know what posts use particular assets at this point in the code, it is best to work around this
issue by unsetting the thumbnail filenames rather than deleting the entries outright. This effectively
generates them again on the next request.

In the future, we should aim to keep track of what posts make use of assets, so cache may be invalidated
in a more targeted way.
2022-07-07 14:22:22 +02:00
b5edf09a69 Don't try to generate double-density thumbs for small images 2022-07-07 14:05:33 +02:00
54fb7ab410 Write new thumbnail filenames to parent Image object as well 2022-07-07 13:55:55 +02:00
086102d007 Thumbnail class: minor refactor of generate method 2022-07-07 13:51:03 +02:00
56b60b74bc Thumbnail class: refactor getUrl method 2022-07-07 13:33:40 +02:00
fc59708914 Split Image::getImageUrls from Image::getInlineImage 2022-07-05 12:01:02 +02:00
1c02cbea93 Rewrite Image::getInlineImage to support double density displays 2022-07-05 11:41:40 +02:00
52420b8715 Add Image::getInlineImage method 2022-06-30 15:22:08 +02:00
7d82a4a924 Merge pull request 'Complete date-ordered orderings' (#29) from electricdusk/pics:assets-complete-ordering into master
Reviewed-on: #29
2022-11-22 21:09:10 +01:00
b7a37c85f6 Complete date-ordered orderings
Bug as reported by Yorick: When two Assets have the same capture
date, a bug occurs in the interface where the user gets stuck in
a loop when moving to the next image.

This patch uses the primary key as a fallback when ordering the
images by capture date.  This way, the asset ordering is complete
and it should resolve the bug.
2022-11-22 12:00:53 +01:00

View File

@ -606,14 +606,12 @@ class Asset
FROM assets_tags AS t
INNER JOIN assets AS a ON a.id_asset = t.id_asset
WHERE t.id_tag = {int:id_tag} AND
a.date_captured <= {datetime:date_captured} AND
a.id_asset != {int:id_asset}
ORDER BY a.date_captured DESC'
(a.date_captured, a.id_asset) < ({datetime:date_captured}, {int:id_asset})
ORDER BY a.date_captured DESC, a.id_asset DESC'
: '
FROM assets AS a
WHERE date_captured >= {datetime:date_captured} AND
a.id_asset != {int:id_asset}
ORDER BY date_captured ASC')
WHERE (a.date_captured, a.id_asset) > ({datetime:date_captured}, {int:id_asset})
ORDER BY date_captured ASC, a.id_asset ASC')
. '
LIMIT 1',
[
@ -639,14 +637,12 @@ class Asset
FROM assets_tags AS t
INNER JOIN assets AS a ON a.id_asset = t.id_asset
WHERE t.id_tag = {int:id_tag} AND
a.date_captured >= {datetime:date_captured} AND
a.id_asset != {int:id_asset}
ORDER BY a.date_captured ASC'
(a.date_captured, a.id_asset) > ({datetime:date_captured}, {int:id_asset})
ORDER BY a.date_captured ASC, a.id_asset ASC'
: '
FROM assets AS a
WHERE date_captured <= {datetime:date_captured} AND
a.id_asset != {int:id_asset}
ORDER BY date_captured DESC')
WHERE (a.date_captured, a.id_asset) < ({datetime:date_captured}, {int:id_asset})
ORDER BY date_captured DESC, a.id_asset DESC')
. '
LIMIT 1',
[