cancel
Showing results for 
Search instead for 
Did you mean: 

Set folder icon/thumbnail with image reside in repository

melttech
Champ in-the-making
Champ in-the-making
Hi,

Im using Alfresco community v4.2 and i want t see this feature only in Alfresco Explorer

I want to change the folder icon to an image. The image should be found inside the repository (for example under Company Home/User Homes/User1/)
So everytime an image is uploaded under Company Home/User Homes/User1/, the image will be transform to a thumbnail and set as its parent icon.

I know we can change the folder icon by javascript but the image must be available in alfresco/images folder. How can i get the image from alfresco repository Company Home/User Homes/User1/?

All I want to do is to set the user photo as their folder icon.

Anyone has an idea how to do this?

Cheers
2 REPLIES 2

iblanco
Confirmed Champ
Confirmed Champ
I'm using Alfresco 4.0, I'm assuming 4.2 is similar.

Well if you already know how to change the image by client side javascript and the only thing you need is a way to refer to the thumbnail that is not inside the web deployment but the repository itself I ssugest you give a look to the thumbnail REST API that Share itself is using.

If you inspect the HTML that share creates to show the thumbnail of an image in the document browsing view you'll see something like this:


<img id="workspace://SpacesStore/1fd7537e-bda4-4d08-94e7-592de27e3b35" src="http://localhost:8080/share/proxy/alfresco/api/node/workspace/SpacesStore/AAAAAAAA-BBBB-CCCC-DDDD-AB..." alt=".jpg" title="Hydrangeas.jpg">


I think this is referring to this API:

http://localhost:8080/alfresco/service/index/uri/api/node/%7Bstore_type%7D/%7Bstore_id%7D/%7Bid%7D/c...



If you want to manage the thumbnail creation yourself or if you want to directly use and existing image and not its thumbnail I suppose you could just embed in your generated IMG element a URL pointing to the content download URL:


http://localhost:8080/share/proxy/alfresco/api/node/content/workspace/SpacesStore/b619888c-0c4e-4c31...


But of course that assumes you now the NodeRef of the image yo want to use. Probably you'll have to copy and customize the thumbnail API so that it searches inside the folder for the proper node.

melttech
Champ in-the-making
Champ in-the-making
Thanks iblanco for your reply,

I did try to change Alfresco Explorer browse.jsp. I found that the folder icon for icon view is set here :

<%– Primary column for icons view mode –%>
<a:column id="col2" primary="true" style="padding:2px;text-align:left;vertical-align:top;" rendered="#{BrowseBean.browseViewMode == 'icons'}">
<f:facet name="large-icon">
<a:actionLink id="col2-act1" value="#{r.name}" image="/images/icons/#{r.icon}.gif" actionListener="#{BrowseBean.clickSpace}" showLink="false">
<fSmiley Tonguearam name="id" value="#{r.id}" id="param5" />
</a:actionLink>
</f:facet>
<a:actionLink id="col2-act2" value="#{r.name}" actionListener="#{BrowseBean.clickSpace}" styleClass="header">
<fSmiley Tonguearam name="id" value="#{r.id}" id="param6" />
</a:actionLink>
<r:nodeInfo id="col2-info" value="#{r.id}">
<h:graphicImage id="col2-img" url="/images/icons/popup.gif" styleClass="popupImage" width="16" height="16" />
</r:nodeInfo>
</a:column>

i did try to change it to point to a URL but it doesnt work. Plus, this will change all the icons of cm:folder.

I suppose you are suggesting me to use thumbnail service Api (https://wiki.alfresco.com/wiki/Thumbnail_Service) but im not quite familiar with it.Is there something need to be configure and how i can make use of this api to change only a folder icon from javascript?

Any idea? If its impossible with javascript, are they any other alternative way to do this (eg: Java). I dont have the global view on how can i do this.

Please enligthen my path 😃