Page MenuHomePhabricator

Provide thumbnails on the file list
Open, LowPublicFeature

Description

Upstream: https://we.phorge.it/T16039

When going through the list of files I shared it would be very convenient to have a visual representation of those in addition to their name, especially for mockups and other image based assets.

Event Timeline

Aklapper triaged this task as Lowest priority.May 30 2021, 9:36 AM
Aklapper changed the subtype of this task from "Task" to "Feature Request".Oct 28 2023, 2:10 PM

First step would likely make File Transforms by default also create a "Thumbgrid (100px)"/TRANSFORM_THUMBGRID.
Currently the code only creates a "Preview (220px)"/TRANSFORM_PREVIEW by default for bitmap image files).

Aklapper raised the priority of this task from Lowest to Low.EditedMar 23 2025, 1:09 PM

Proof of concept patch to render 48x48px thumbnails for image files:

1diff --git a/src/applications/files/query/PhabricatorFileSearchEngine.php b/src/applications/files/query/PhabricatorFileSearchEngine.php
2index c2d36acfd6..c9d7af20af 100644
3--- a/src/applications/files/query/PhabricatorFileSearchEngine.php
4+++ b/src/applications/files/query/PhabricatorFileSearchEngine.php
5@@ -143,6 +143,10 @@ final class PhabricatorFileSearchEngine
6 $list_view = id(new PHUIObjectItemListView())
7 ->setUser($viewer);
8
9+ if ($query->getQueryKey() === 'authored') {
10+ $authored_view = true;
11+ }
12+
13 foreach ($files as $file) {
14 $id = $file->getID();
15 $phid = $file->getPHID();
16@@ -158,12 +162,30 @@ final class PhabricatorFileSearchEngine
17 $uploaded = pht('Uploaded on %s', $date_created);
18 }
19
20+ // render image thumbnails when looking at your authored files
21+ $thumbnail = null;
22+ if (isset($authored_view)) {
23+ if ($file->isViewableImage()) {
24+ $xform = PhabricatorFileTransform::getTransformByKey(
25+ PhabricatorFileThumbnailTransform::TRANSFORM_THUMBGRID);
26+ $attributes = array(
27+ 'width' => 48,
28+ 'height' => 48,
29+ 'src' => $file->getURIForTransform($xform),
30+ );
31+ $thumbnail = phutil_tag('img', $attributes);
32+ } else {
33+ $thumbnail = phutil_tag('span');
34+ }
35+ }
36+
37 $item = id(new PHUIObjectItemView())
38 ->setObject($file)
39 ->setObjectName("F{$id}")
40 ->setHeader($name)
41 ->setHref($file_uri)
42 ->addAttribute($uploaded)
43+ ->setSideColumn($thumbnail)
44 ->addIcon('none', phutil_format_bytes($file->getByteSize()));
45
46 $ttl = $file->getTTL();
47diff --git a/webroot/rsrc/css/phui/object-item/phui-oi-list-view.css b/webroot/rsrc/css/phui/object-item/phui-oi-list-view.css
48index 0ae87aafcf..9b8e801aa5 100644
49--- a/webroot/rsrc/css/phui/object-item/phui-oi-list-view.css
50+++ b/webroot/rsrc/css/phui/object-item/phui-oi-list-view.css
51@@ -190,6 +190,10 @@ ul.phui-oi-list-view {
52 width: 200px;
53 }
54
55+.phui-oi-col2.phui-oi-side-column > img {
56+ display: inline-block;
57+}
58+
59 .device-phone .phui-oi-col1,
60 .device-phone .phui-oi-col2 {
61 display: block;

A bit expensive thus only rendering for your own authored files.
Plus turns everything into a square but I don't mind.
Plus re-uses some hardcoded too-wide column width but I don't mind.

Aklapper moved this task from Backlog to Upstreamed on the Phabricator (Upstream) board.
Aklapper moved this task from Backlog to Reported Upstream on the Upstream board.