mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
Merge remote-tracking branch 'origin/master' into 2.2
# Conflicts: # .editorconfig # docs/de/index.rst # docs/de/user/import.rst # docs/en/index.rst # docs/en/user/configuration.rst # docs/en/user/import.rst # docs/fr/index.rst # docs/fr/user/import.rst # src/Wallabag/CoreBundle/Command/InstallCommand.php # src/Wallabag/CoreBundle/Resources/translations/messages.da.yml # src/Wallabag/CoreBundle/Resources/translations/messages.de.yml # src/Wallabag/CoreBundle/Resources/translations/messages.en.yml # src/Wallabag/CoreBundle/Resources/translations/messages.es.yml # src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml # src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml # src/Wallabag/CoreBundle/Resources/translations/messages.it.yml # src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml # src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml # src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml # src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml # src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml # src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig # web/bundles/wallabagcore/themes/baggy/css/style.min.css # web/bundles/wallabagcore/themes/baggy/js/baggy.min.js # web/bundles/wallabagcore/themes/material/css/style.min.css # web/bundles/wallabagcore/themes/material/js/material.min.js
This commit is contained in:
commit
68003139e1
124 changed files with 2814 additions and 2573 deletions
|
@ -8,6 +8,7 @@ use Wallabag\CoreBundle\Entity\Entry;
|
|||
use Wallabag\CoreBundle\Entity\Tag;
|
||||
use Wallabag\CoreBundle\Tools\Utils;
|
||||
use Wallabag\CoreBundle\Repository\TagRepository;
|
||||
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeExtensionGuesser;
|
||||
|
||||
/**
|
||||
* This kind of proxy class take care of getting the content from an url
|
||||
|
@ -19,6 +20,7 @@ class ContentProxy
|
|||
protected $tagger;
|
||||
protected $logger;
|
||||
protected $tagRepository;
|
||||
protected $mimeGuesser;
|
||||
|
||||
public function __construct(Graby $graby, RuleBasedTagger $tagger, TagRepository $tagRepository, LoggerInterface $logger)
|
||||
{
|
||||
|
@ -26,6 +28,7 @@ class ContentProxy
|
|||
$this->tagger = $tagger;
|
||||
$this->logger = $logger;
|
||||
$this->tagRepository = $tagRepository;
|
||||
$this->mimeGuesser = new MimeTypeExtensionGuesser();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -81,6 +84,11 @@ class ContentProxy
|
|||
$entry->setPreviewPicture($content['open_graph']['og_image']);
|
||||
}
|
||||
|
||||
// if content is an image define as a preview too
|
||||
if (in_array($this->mimeGuesser->guess($content['content_type']), ['jpeg', 'jpg', 'gif', 'png'], true)) {
|
||||
$entry->setPreviewPicture($content['url']);
|
||||
}
|
||||
|
||||
try {
|
||||
$this->tagger->tag($entry);
|
||||
} catch (\Exception $e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue