$media = common_get_mime_media($file->mimetype);
if (Event::handle('CreateFileImageThumbnailSource', array($file, &$imgPath, $media))) {
if (empty($file->filename) && !file_exists($imgPath)) {
- throw new UnsupportedMediaException(_m('File without filename could not get a thumbnail source.'));
+ throw new FileNotFoundException($imgPath);
}
// First some mimetype specific exceptions
if (isset($url)) {
foreach (['xml', 'json'] as $format) {
$action->element('link',
- array('rel' =>'alternate',
- 'type' => "application/{$format}+oembed",
- 'href' => common_local_url('oembed',
- array(),
- array('format' => $format, 'url' => $url)),
- 'title' => 'oEmbed'));
+ ['rel' =>'alternate',
+ 'type' => "application/{$format}+oembed",
+ 'href' => common_local_url('oembed',
+ [],
+ ['format' => $format, 'url' => $url]),
+ 'title' => 'oEmbed']);
}
}
return true;
$thumb = $file->getThumbnail(128, 128);
$out->element('img', $thumb->getHtmlAttrs(['class'=>'u-photo embed']));
unset($thumb);
+ } catch (FileNotFoundException $e){
+ // Nothing to show
} catch (Exception $e) {
$out->element('div', ['class'=>'error'], $e->getMessage());
}
// Out
$imgPath = $thumbnail->getPath();
- return false;
+ return !file_exists($imgPath);
}
/**