*
* @return File_thumbnail
*/
- public function getThumbnail($width=null, $height=null, $crop=false)
+ public function getThumbnail($width=null, $height=null, $crop=false, $force_still=true)
{
// Get some more information about this file through our ImageFile class
$image = ImageFile::fromFileObject($this);
- if ($image->animated && is_null(common_config('thumbnail', 'animated'))) {
- throw new UseFileAsThumbnailException($this->id);
+ if ($image->animated && !common_config('thumbnail', 'animated')) {
+ // null means "always use file as thumbnail"
+ // false means you get choice between frozen frame or original when calling getThumbnail
+ if (is_null(common_config('thumbnail', 'animated')) || !$force_still) {
+ throw new UseFileAsThumbnailException($this->id);
+ }
}
if ($width === null) {
case 'image/jpg':
case 'image/jpeg':
try {
- $thumb = $this->attachment->getThumbnail();
+ // Tell getThumbnail that we can show an animated image if it has one (4th arg, "force_still")
+ $thumb = $this->attachment->getThumbnail(null, null, false, false);
$this->out->element('img', array('class'=>'u-photo', 'src' => $thumb->getUrl(), 'alt' => ''));
} catch (UseFileAsThumbnailException $e) {
$this->out->element('img', array('class'=>'u-photo', 'src' => $e->file->getUrl(), 'alt' => $e->file->title));
'maxsize' => 1000, // thumbs with an edge larger than this will not be generated
'width' => 450,
'height' => 600,
- 'animated' => null), // null="UseFileAsThumbnail", false="take still image". true requires ImageMagickPlugin
+ 'animated' => false), // null="UseFileAsThumbnail", false="can use still frame". true requires ImageMagickPlugin
'application' =>
array('desclimit' => null),
'group' =>