Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,16 @@ class FtpAdapter implements AdapterInterface
$obj->modified_date = $obj->create_date;
$obj->modified_date_formatted = $obj->create_date_formatted;
$obj->mime_type = $file['type'] == 'file' ? $this->extension_mime_mapper(strrchr($file['name'], ".")) : "directory";
if ($obj->mime_type == 'image/png' || $obj->mime_type == 'image/jpeg') {
$obj->thumb_path = Uri::root() . "images/powered_by.png";
}
$obj->width = 0;
$obj->height = 0;


// Add thumbnail preview when possible. Recomended size: should fit in to 200x200px box.
// Relative or full path.
$obj->thumb_path = Uri::root(true) . '/images/powered_by.png';
// Optional, an actual size of thumbnail to enable lazy loading
$obj->thumb_width = 200;
$obj->thumb_height = 44;

return $obj;
}
}
Expand Down Expand Up @@ -520,12 +524,16 @@ class FtpAdapter implements AdapterInterface
$obj->modified_date = $obj->create_date;
$obj->modified_date_formatted = $obj->create_date_formatted;
$obj->mime_type = $file['type'] == 'file' ? $this->extension_mime_mapper(strrchr($file['name'], ".")) : "directory";
if ($obj->mime_type == 'image/png' || $obj->mime_type == 'image/jpeg') {
$obj->thumb_path = Uri::root() . "images/powered_by.png";
}
$obj->width = 0;
$obj->height = 0;


// Add thumbnail preview when possible. Recomended size: should fit in to 200x200px box.
// Relative or full path.
$obj->thumb_path = Uri::root(true) . '/images/powered_by.png';
// Optional, an actual size of thumbnail to enable lazy loading
$obj->thumb_width = 200;
$obj->thumb_height = 44;

$results[] = $obj;
return $results;
} else {
Expand Down Expand Up @@ -553,12 +561,16 @@ class FtpAdapter implements AdapterInterface
$obj->modified_date = $obj->create_date;
$obj->modified_date_formatted = $obj->create_date_formatted;
$obj->mime_type = $file['type'] == 'file' ? $this->extension_mime_mapper(strrchr($file['name'], ".")) : "directory";
if ($obj->mime_type == 'image/png' || $obj->mime_type == 'image/jpeg') {
$obj->thumb_path = Uri::root() . "images/powered_by.png";
}
$obj->width = 0;
$obj->height = 0;

// Add thumbnail preview when possible. Recomended size: should fit in to 200x200px box.
// Relative or full path.
$obj->thumb_path = Uri::root(true) . '/images/powered_by.png';
// Optional, an actual size of thumbnail to enable lazy loading
$obj->thumb_width = 200;
$obj->thumb_height = 44;

$results[] = $obj;
}
return $results;
Expand Down Expand Up @@ -938,4 +950,4 @@ class FtpAdapter implements AdapterInterface
return $nameWithoutExtension . $extension;
}
}
```
```
6 changes: 6 additions & 0 deletions migrations/52-53/new-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,9 @@ public function onInstallerBeforeUpdateSiteDownload(\Joomla\CMS\Event\Installer\
$event->updateUrl($event->getUrl() . '?auth=foo');
}
```

#### Media: allow thumbnail for any file type

The changes allow to add thumbnail for any file type: video, pdf, audio etc. Previously it was worked only for images.

PR: https://github.com/joomla/joomla-cms/pull/44847