Select the first generated thumbnail, which should be the proper size

...most of the time. If all works well.
This commit is contained in:
Mikael Nordfeldth 2016-07-21 00:37:43 +02:00
parent d5c733919b
commit 1981cb7662

View File

@ -98,6 +98,7 @@ class File_thumbnail extends Managed_DataObject
if ($notNullUrl) { if ($notNullUrl) {
$thumb->whereAdd('url IS NOT NULL'); $thumb->whereAdd('url IS NOT NULL');
} }
$thumb->orderBy('modified ASC'); // the first created, a somewhat ugly hack
$thumb->limit(1); $thumb->limit(1);
if (!$thumb->find(true)) { if (!$thumb->find(true)) {
throw new NoResultException($thumb); throw new NoResultException($thumb);