summaryrefslogtreecommitdiffstats
path: root/lib/Service/DocumentService.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Service/DocumentService.php')
-rw-r--r--lib/Service/DocumentService.php25
1 files changed, 21 insertions, 4 deletions
diff --git a/lib/Service/DocumentService.php b/lib/Service/DocumentService.php
index 4fedac0c..d9630955 100644
--- a/lib/Service/DocumentService.php
+++ b/lib/Service/DocumentService.php
@@ -143,9 +143,7 @@ class DocumentService {
$this->cacheDocumentsRequest->initCaching($document);
try {
- $localCopy = $this->cacheService->saveRemoteFileToCache($document->getUrl(), $mime);
- $document->setMimeType($mime);
- $document->setLocalCopy($localCopy);
+ $this->cacheService->saveRemoteFileToCache($document, $mime);
$this->cacheDocumentsRequest->endCaching($document);
$this->streamRequest->updateAttachments($document);
@@ -192,8 +190,26 @@ class DocumentService {
/**
* @param string $id
+ * @param bool $public
*
+ * @return ISimpleFile
+ * @throws CacheContentException
+ * @throws CacheDocumentDoesNotExistException
+ * @throws MalformedArrayException
+ * @throws RequestResultNotJsonException
+ * @throws SocialAppConfigException
+ */
+ public function getResizedFromCache(string $id, bool $public = false) {
+ $document = $this->cacheRemoteDocument($id, $public);
+
+ return $this->cacheService->getContentFromCache($document->getResizedCopy());
+ }
+
+
+ /**
+ * @param string $id
* @param bool $public
+ * @param string $mimeType
*
* @return ISimpleFile
* @throws CacheContentException
@@ -202,8 +218,9 @@ class DocumentService {
* @throws RequestResultNotJsonException
* @throws SocialAppConfigException
*/
- public function getFromCache(string $id, bool $public = false) {
+ public function getFromCache(string $id, bool $public = false, string &$mimeType = '') {
$document = $this->cacheRemoteDocument($id, $public);
+ $mimeType = $document->getMimeType();
return $this->cacheService->getContentFromCache($document->getLocalCopy());
}