Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blurhash generation #41044

Merged
merged 1 commit into from
Jan 5, 2024
Merged

Blurhash generation #41044

merged 1 commit into from
Jan 5, 2024

Conversation

ArtificialOwl
Copy link
Member

@ArtificialOwl ArtificialOwl commented Oct 22, 2023

Catching FilesMetadata's event and when encountering an image file, this will fill metadata with blurhash [1] which is a little string that simulate a placeholder.

Should greatly improve loading smoothness when displaying gallery of pictures


If you want to test:

  • patch 3rdparty#1625
  • upload a picture and get file id
  • run the cron
  • run ./occ metadata:get <file_id>
  • paste the value in [1] (blurhash string)
$ php -f cron.php 
$ ./occ metadata:get 21
{
    "blurhash": {
        "value": "LTGX}Xs,|IOWV]NbjIazxFods.j@",
        "type": "string",
        "indexed": false,
        "editPermission": 0
    }
}

image

[1] https://blurha.sh/

@ArtificialOwl ArtificialOwl added the 2. developing Work in progress label Oct 22, 2023
@ArtificialOwl
Copy link
Member Author

example:
image

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Psalm found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

@ArtificialOwl ArtificialOwl force-pushed the enh/noid/files-metadata branch from 15cdbe8 to c89df97 Compare October 22, 2023 11:21
@ArtificialOwl ArtificialOwl force-pushed the enh/noid/blurhash branch 2 times, most recently from 7ab7aaa to 1cbbe62 Compare October 24, 2023 12:29
@artonge artonge mentioned this pull request Oct 26, 2023
29 tasks
@ArtificialOwl ArtificialOwl force-pushed the enh/noid/files-metadata branch from 1b13b8e to 683ef89 Compare October 26, 2023 13:24
@solracsf solracsf added this to the Nextcloud 28 milestone Oct 27, 2023
@ArtificialOwl ArtificialOwl force-pushed the enh/noid/files-metadata branch 4 times, most recently from 9ab9645 to 76faa13 Compare October 27, 2023 19:10
@skjnldsv skjnldsv mentioned this pull request Nov 1, 2023
@ArtificialOwl ArtificialOwl force-pushed the enh/noid/files-metadata branch 5 times, most recently from 1065e8a to 2fc9ba3 Compare November 6, 2023 15:48
@blizzz blizzz mentioned this pull request Nov 6, 2023
@ArtificialOwl ArtificialOwl force-pushed the enh/noid/files-metadata branch 2 times, most recently from 7205ff1 to f497d8b Compare November 7, 2023 13:43
@skjnldsv skjnldsv modified the milestones: Nextcloud 28, Nextcloud 29 Nov 7, 2023
Base automatically changed from enh/noid/files-metadata to master November 7, 2023 16:55
@ArtificialOwl ArtificialOwl requested review from a team, nfebe, szaimen, sorbaugh and icewind1991 and removed request for a team January 4, 2024 12:29
@szaimen szaimen requested review from nickvergessen and removed request for szaimen January 4, 2024 15:54
@skjnldsv skjnldsv added enhancement 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Jan 5, 2024
Signed-off-by: Maxence Lange <[email protected]>
@skjnldsv skjnldsv enabled auto-merge January 5, 2024 10:51
@skjnldsv skjnldsv merged commit 24952b9 into master Jan 5, 2024
50 checks passed
@skjnldsv skjnldsv deleted the enh/noid/blurhash branch January 5, 2024 11:29
@SystemKeeper
Copy link
Contributor

Is it expected that running files:scan --generate-metadata --all is significantly slower with this?

Without blurhash:

Starting scan for user 1 out of 12 (admin)
Starting scan for user 2 out of 12 (alice)
Starting scan for user 3 out of 12 (bob)
Starting scan for user 4 out of 12 (jane)
Starting scan for user 5 out of 12 (john)
Starting scan for user 6 out of 12 (nextcloud-mm)
Starting scan for user 7 out of 12 (user1)
Starting scan for user 8 out of 12 (user2)
Starting scan for user 9 out of 12 (user3)
Starting scan for user 10 out of 12 (user4)
Starting scan for user 11 out of 12 (user5)
Starting scan for user 12 out of 12 (user6)
+---------+-------+-----+---------+---------+--------+--------------+
| Folders | Files | New | Updated | Removed | Errors | Elapsed time |
+---------+-------+-----+---------+---------+--------+--------------+
| 32      | 19    | 0   | 0       | 0       | 0      | 00:00:00     |
+---------+-------+-----+---------+---------+--------+--------------+

With blurhash:

Starting scan for user 1 out of 12 (admin)
Starting scan for user 2 out of 12 (alice)
Starting scan for user 3 out of 12 (bob)
Starting scan for user 4 out of 12 (jane)
Starting scan for user 5 out of 12 (john)
Starting scan for user 6 out of 12 (nextcloud-mm)
Starting scan for user 7 out of 12 (user1)
Starting scan for user 8 out of 12 (user2)
Starting scan for user 9 out of 12 (user3)
Starting scan for user 10 out of 12 (user4)
Starting scan for user 11 out of 12 (user5)
Starting scan for user 12 out of 12 (user6)
+---------+-------+-----+---------+---------+--------+--------------+
| Folders | Files | New | Updated | Removed | Errors | Elapsed time |
+---------+-------+-----+---------+---------+--------+--------------+
| 32      | 19    | 0   | 0       | 0       | 0      | 00:00:07     |
+---------+-------+-----+---------+---------+--------+--------------+

@ArtificialOwl
Copy link
Member Author

Yes,

  • what type of file are you testing with ?
  • what is the elapsed time if you try a second time ?

@SystemKeeper
Copy link
Contributor

3 times with blurhash:

+---------+-------+-----+---------+---------+--------+--------------+
| Folders | Files | New | Updated | Removed | Errors | Elapsed time |
+---------+-------+-----+---------+---------+--------+--------------+
| 32      | 19    | 0   | 0       | 0       | 0      | 00:00:05     |
+---------+-------+-----+---------+---------+--------+--------------+
+---------+-------+-----+---------+---------+--------+--------------+
| Folders | Files | New | Updated | Removed | Errors | Elapsed time |
+---------+-------+-----+---------+---------+--------+--------------+
| 32      | 19    | 0   | 0       | 0       | 0      | 00:00:05     |
+---------+-------+-----+---------+---------+--------+--------------+
+---------+-------+-----+---------+---------+--------+--------------+
| Folders | Files | New | Updated | Removed | Errors | Elapsed time |
+---------+-------+-----+---------+---------+--------+--------------+
| 32      | 19    | 0   | 0       | 0       | 0      | 00:00:06     |
+---------+-------+-----+---------+---------+--------+--------------+

and three times without:

+---------+-------+-----+---------+---------+--------+--------------+
| Folders | Files | New | Updated | Removed | Errors | Elapsed time |
+---------+-------+-----+---------+---------+--------+--------------+
| 32      | 19    | 0   | 0       | 0       | 0      | 00:00:00     |
+---------+-------+-----+---------+---------+--------+--------------+
+---------+-------+-----+---------+---------+--------+--------------+
| Folders | Files | New | Updated | Removed | Errors | Elapsed time |
+---------+-------+-----+---------+---------+--------+--------------+
| 32      | 19    | 0   | 0       | 0       | 0      | 00:00:00     |
+---------+-------+-----+---------+---------+--------+--------------+
+---------+-------+-----+---------+---------+--------+--------------+
| Folders | Files | New | Updated | Removed | Errors | Elapsed time |
+---------+-------+-----+---------+---------+--------+--------------+
| 32      | 19    | 0   | 0       | 0       | 0      | 00:00:00     |
+---------+-------+-----+---------+---------+--------+--------------+

Basically only the default media files from julius docker dev (see https://github.com/juliushaertl/nextcloud-docker-dev/tree/master/data/skeleton):

Starting scan for user 1 out of 12 (admin)
	Folder	/admin/
	Folder	/admin/cache
	Folder	/admin/files
	File	/admin/files/20240108_153511.gif
	File	/admin/files/Nextcloud_Server_Administration_Manual.pdf
	Folder	/admin/files/Talk
	Folder	/admin/files/Templates
	Folder	/admin/files/Media
	File	/admin/files/Media/photo-1533658925625-2f94d23fc425.jpeg
	File	/admin/files/Media/photo-1517603250781-c4eac1449a80.jpeg
	File	/admin/files/Media/photo-1532597751369-606119ceda8a.jpeg
	File	/admin/files/Media/photo-1527668441211-67a036f77ab4.jpeg
	File	/admin/files/Media/photo-1495962637988-4be9db2af01f.jpeg
	File	/admin/files/Media/Big_Buck_Bunny_1080_10s_10MB.mkv
	File	/admin/files/Media/photo-1498855592392-af2bf1e0a4c7.jpeg
	File	/admin/files/Media/photo-1503991721143-75f95ebf1e55.jpeg

...

Starting scan for user 3 out of 12 (bob)
	Folder	/bob/
	Folder	/bob/cache
	Folder	/bob/files
	File	/bob/files/Nextcloud_Server_Administration_Manual.pdf
	Folder	/bob/files/Vorlagen
	Folder	/bob/files/Talk
	Folder	/bob/files/Media
	File	/bob/files/Media/photo-1533658925625-2f94d23fc425.jpeg
	File	/bob/files/Media/photo-1517603250781-c4eac1449a80.jpeg
	File	/bob/files/Media/photo-1532597751369-606119ceda8a.jpeg
	File	/bob/files/Media/photo-1527668441211-67a036f77ab4.jpeg
	File	/bob/files/Media/photo-1495962637988-4be9db2af01f.jpeg
	File	/bob/files/Media/Big_Buck_Bunny_1080_10s_10MB.mkv
	File	/bob/files/Media/photo-1498855592392-af2bf1e0a4c7.jpeg
	File	/bob/files/Media/photo-1503991721143-75f95ebf1e55.jpeg

...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants