Skip to content

Commit

Permalink
support directus5 thumbnail files formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
benhaynes committed Sep 27, 2016
1 parent f1e3309 commit 585e4dc
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions api/core/Directus/Db/TableGateway/AclAwareTableGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,24 @@ protected function processSelect($selectState, $result)

$thumbnailFilename = $row['id'] . '.' . $thumbnailExtension;
$row['thumbnail_url'] = $thumbnailURL . '/' . $thumbnailFilename;

// filename-ext-100-100-true.jpg
$row['thumbnail_url'] = null;
$filename = implode('.', $thumbnailFilenameParts);
if ($row['type'] == 'embed/vimeo') {
$oldThumbnailFilename = $row['name'] . '-vimeo-220-124-true.jpg';
} else {
$oldThumbnailFilename = $filename . '-' . $thumbnailExtension . '-100-100-true.jpg';
}

// 314551321-vimeo-220-124-true.jpg
// hotfix: there's not thumbnail for this file
if (!$files->exists('thumbs/' . $thumbnailFilename)) {
$row['thumbnail_url'] = null;
if ($files->exists('thumbs/' . $oldThumbnailFilename)) {
$row['thumbnail_url'] = $thumbnailURL . '/' . $oldThumbnailFilename;
}

if ($files->exists('thumbs/' . $thumbnailFilename)) {
$row['thumbnail_url'] = $thumbnailURL . '/' . $thumbnailFilename;
}

$embedManager = Bootstrap::get('embedManager');
Expand Down

0 comments on commit 585e4dc

Please sign in to comment.