3

I need to retrieve the icon of a content file based on its media type.

I know that in Alfresco Explorer you could use the FileTypeImageUtils.getFileTypeImage() method.

Is there something equivalent in Share?

plus-
  • 45,453
  • 15
  • 60
  • 73
  • There's a rest API you can call, is that of use? Or do you want to do it in server side JS? – Gagravarr Nov 17 '11 at 13:57
  • I want to do it client side in the js. for the moment I just hack it like this: `icon: Alfresco.constants.URL_RESCONTEXT + "components/images/filetypes/" + myJson.extension + "-file-32.png"` – plus- Nov 17 '11 at 14:39

1 Answers1

1

Do you want the file icon, or the file thumbnail?

If you're on Alfresco 4.0, the URL to request the thumbnail of a document is /proxy/alfresco/api/node/workspace/[Store]/[ID]/content/thumbnails/doclib?c=queue&ph=true eg http://localhost:8080/share/proxy/alfresco/api/node/workspace/SpacesStore/62d652d5-5759-434e-8739-295fa3447481/content/thumbnails/doclib?c=queue&ph=true

The way to build that is usually:

Alfresco.constants.PROXY_URI + 'api/node/' + nodeRef.uri + '/content/thumbnails/doclib?c=queue&ph=true"

If you do just want the icon, then the code is something like:

Alfresco.constants.URL_RESCONTEXT + 'components/images/filetypes/' + Alfresco.util.getFileIcon(name)
Gagravarr
  • 47,320
  • 10
  • 111
  • 156