Fórum

Image download without extension while saving through WCM

thumbnail
Raja Seth, modificado 9 Anos atrás.

Image download without extension while saving through WCM

Regular Member Postagens: 233 Data de Entrada: 18/08/11 Postagens Recentes
Hi All,

I created an image carousel using my structure/template in which I have a functionality while clicking on the image it should be downloaded. For which I have given the anchor tag as below :


<div class="span3">
<a href="$currentImage.getData()" download class="thumbnail">
<img src="$currentImage.getData()" alt="Image" style="max-width:100%;" />
</a>
</div>


When the image is downloaded, it doesn't have file extension (such as jpg, png, etc). I guess this is because the image src is as :

/image/journal/article?img_id=11071&t=1421059493067

Is there any way while displaying image in web content we can display with extension?

Thanks & Regards,
Raja
thumbnail
Raja Seth, modificado 9 Anos atrás.

RE: Image download without extension while saving through WCM

Regular Member Postagens: 233 Data de Entrada: 18/08/11 Postagens Recentes
Any help on this???
thumbnail
Raja Seth, modificado 9 Anos atrás.

RE: Image download without extension while saving through WCM (Resposta)

Regular Member Postagens: 233 Data de Entrada: 18/08/11 Postagens Recentes
Finally, I had to go with the code below which will call the method of ImageLocalServiceUtil class.

#set ($imageService = $portal.getClass().forName('com.liferay.portal.service.ImageLocalServiceUtil').getMethod("getService", null).invoke(null, null))


With the $imgId having the image id,

$imageService.fetchImage($imgId).getType()


Also need to add the below two properties in portal-ext.properties file :

velocity.engine.restricted.classes=
velocity.engine.restricted.variables=


I solved my problem.

Regards,
Raja