I want to get the thumbnail of all Files stored in Document and Media portlet of Liferay ,for images thumbnails i am using these libraries
import com.liferay.portlet.documentlibrary.util.ImageProcessorUtil;
import com.liferay.portlet.documentlibrary.util.DLPreviewableProcessor;
and for getting thumbnail stream i am using this mechanism
InputStream thumbnail = ImageProcessorUtil.getThumbnailAsStream(f.getFileVersion(), DLPreviewableProcessor.THUMBNAIL_INDEX_DEFAULT);
My problem is that i want to get the thumbnail stream of all contents stored in Liferay.Is is possible??? any help will be greatly appreciated.
This functionality is already provided by Liferay. As the documentation suggests, you will need to configure some 3rd party tools/libraries on your Liferay instance.
If you just want to change the default thumbnail images, then you can update your replace these images with the images of your choice at _unstyled\images\file_system\large and _unstyled\images\file_system\small in your theme.
EDIT
To answer your last comment about previewing XML file (which I have answered on high level above, but nevertheless...):
Add the below property in your portal-ext.properties file:
dl.file.generic.extensions[xmlimage]=xml
And, add xmlimage.png file in _unstyled\images\file_system\large
and _unstyled\images\file_system\small in your theme.
Related
I want to get the actual Video File Url from an embedded video on any website. It essentially is not YouTube. It can be any website.
I am coding for android on Java.
For Example :
The thing I want to do is same as this IDM button does :
[Actually not the same because the button there captures a network stream when it gets started by the player. But I want to get the file straight from the player.]
Is there a way to attain this? Can Any external Library [e.g. Jsoup] do this?
I am already using Jsoup to get some other contents of the page but I have no idea how to do this.
If your using jsoup you can get the url quite easily. Just use jsoup to select all the possible video tags (<iframe>, <videos>, <embed>, etc). Then get the src attribute and store that where you want it:
Example
//Standard Jsoup search
Elements iframes = body.select("iframe");
/*Gets the src of all the iframes or other tag, and if you have
multiple videos you might have to do this in a for loop.*/
String videoURL = iframes.attr("src");
As you may know that different website have different video downloading strategies, some might give a real url in html file for directly download, others may just return video stream while click button or touch screen.
while so many different strategies on video download its really hard for you to find a universal way to fetch a real url to start a download task. But here I have an idea, not so smart, it can be very dumb:
1.play a video in the background(to let browser download that video in browser cache).
2.find that cache file and extract video file which you want.
for myself, I usually have some videos that I want but can not be downloaded straightly, thus I will use IE to play that video and find that video in IE temporary folder.
wish I could help you!
I am using JavaFx-2.I need to view the pdf file in JavaFx. I searched in Google and found the below link.
http://www.idrsolutions.com/jpedalfx-viewer/
In this link I have created every thing whatever mentioned there and I am able to see PdfHelpPanel in Palette. When I drag this component to the PDFHelpFrame I am able to see the fileLocations property. Here I need to give the file locations but I don't know how to give the location of my pdf file. When I click browse in filelocations property it is asking for Custom Code, Default Editor, value from existing component. Which one I need to select. I am struck up exactly at
http://netbeans.dzone.com/articles/how-create-import-a-javabean-c-0
second image from last. If any one has done this already can you help me?
You can use this project https://github.com/james-d/PdfViewer
It uses PDFRenderer library.
I'm using JFreeChart to generate a dynamic chart depending on the user input. I have a JSP with some textbox and combobox, the user makes the input and submits it, and the Action process it, generating an image of a chart. I need to display this image on the same JSP as before, below the textbox/combobox.
If I use response.setContentType("image/jpeg"); etc... then I get a page with the image alone. I thought of saving the image to a file and then access it with <img >, but I'm not sure that will work (need to save it to WebContent and I may not be able to access it always?).
Is there a way to somehow cache the image and then access it inside the JSP through an <img> or something? Maybe JFreeChart has an easy way to do what I want?
If it matters, I'm also using struts and spring on my webapp.
Thanks in advance.
I've not tried it, but you might look into org.jfree.chart.imagemap and a suitable URL generator from org.jfree.chart.urls. An outline of implementing a PieURLGenerator is illustrated here.
Well, if you generate the image on the server side, you could always just store it in a temp directory using something like a UUID to generate a unique name for it, and concatenating the image file extension on the end of it.
Make sure that the directory the image is generated is accessible on the webserver, and then send the URL path to the image file on the server back to the JSP using ajax (Direct Web Remoting), for display using Javascript.
Just make sure you also have a chron job or service to clear the older files out of the directory now and again.
You should have a servlet that can create the image you want solely from the URL. The URL can then contain an id, which maps back to an object in your program containing raw data in memory. The servlet then generates the image and returns it.
You can then simply set the url of the image in your current web page in Javascript, and it should be loaded.
This is because JSP's are character oriented which do not lend well to binary data so you need to have a servlet do it.
I didn't change the configuration , but i found the uploaded images were stored with no extension. This makes me confused when managing those images.
Is there anyone knows how to deal with this ?
You're doing it wrong. Checkout this article.
Especially the part about saving the file.
And secondly, when uploading, you're uploading files. Not images by default. And files do not have img extensions. That part has to be managed manually.
I'm writing a bitmap editor. Each document consists of about 3 bitmap layers and documents are, at the moment, saved as a custom file with a .bme extension. These files can be converted to standard jpg/png files by rendering each bitmap on top of one bitmap and saving the latter.
I need some way for the user to be able to select .bme files they've created already. Is there anything in Android that can make this easier for me?
The only option I can see is to write an activity that creates a list view and write a list adapter that looks for .bme files on disk i.e. a copy of the standard "Media Gallery" app that works for my .bme files. The list adapter will either have to generate a thumbnail preview of the image to show to the user or I'll have to package such a preview in the .bme file when they're created.
This is the only option I can think of. I thought I'd ask in case there is more Android friendly way of doing this. For example, can you add custom file support to the "Media Gallery" app?
Is there anything in Android that can make this easier for me?
Nothing built in. If it weren't for the extension filter, you could link to OI File Manager.
This is the only option I can think of.
It seems like a fine, upstanding option.
For example, can you add custom file support to the "Media Gallery" app?
Not that I am aware of, sorry. Besides, that app is not on all phones.