[owncloud-devel] On adding preview providers

Frank de Lange owncloud-f at unternet.org
Thu Dec 11 23:19:49 GMT 2014


In a previous discussion...

> File Preview for New File Type
>
> You need to write a class that implements certain methods:
> - getMimeType() - this function should return 'application/dicom’ in
> your case.
> - getThumbnail() - this function would return the actual preview.

...and...

> Finally you need to register your preview providers.
> You would put this line of code into your appinfo/app.php
> ```
> \OC\Preview::registerProvider('OC\Preview\PDF’);
> ```
> 
> You shouldn’t use \OC\Preview directly, but sadly there is no public
> api function for this yet.

...I overheard Georg Ehrke state that he'd...

> I’ll add one and I’ll also write a proper interface for preview
> providers.

I made a preview provider for ePub documents, to be used with the OPDS
catalog (files_opds) app. Splicing this provider in to Owncloud from
within an app directory feels rather unclean as it involves using an
alien namespace (preview providers seem to want to live in \OC\Preview)
in an app directory, necessitating the use of 'require' to get the
classes loaded. A 'proper interface for preview providers' sounds like
a good thing to have - has one been created?

Gr//Fr
-- 
   WWWWW      ________________________
  ## o o\    /     Frank de Lange     \
  }#   \|   /                          \
   \ `--| _/     <Hacker for Hire>      \
    `---'  \       +46-734352015        /
            \ owncloud-f at unternet.org  /
             `------------------------'
  [ "Omnis enim res, quae dando non deficit, dum habetur
     et non datur, nondum habetur, quomodo habenda est."  ]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mailman.owncloud.org/pipermail/devel/attachments/20141212/7be2b2b5/attachment.sig>


More information about the Devel mailing list