[opencms-dev] Creating CmsResources from JSP
Matthew Evans
matte at solidstategroup.com
Mon Oct 20 17:53:01 CEST 2003
I'd like to create an image resource from jsp, but I am having problems.
This is what I have so far...
Code:
<%
}
int lines = 0;
while (i.hasNext()) {
CmsFile f = (CmsFile)i.next();
out.println("<tr>");
String inputImage = f.getAbsolutePath();
//debug code, uncomment to print out the input filename
out.println("Read:" + inputImage + "<br>");
File inputFile= new File(f.getAbsolutePath());
String inputPath = inputImage.substring(0,inputImage.lastIndexOf("/"));
String fileNameWE = f.getName().substring(0,f.getName().lastIndexOf("."));
String outputPath = inputPath + "/thumbnails/";
String outputFile = outputPath + fileNameWE + ".jpg";
//debug code, uncomment to print out the input filename
out.println("Write:" + outputFile + "<br>");
//create the output file
CmsResource outputFileName = cmso.createResource(outputPath,fileNameWE +
".jpg", "image");
out.println(outputFileName.getName());
but I'm not sure how to write the contents of the file, or how to check if
the file already exists.
Any help appreciated.
Cheers,
M at .
Matthew Evans
SolidStateGroup
tel. +44 (0) 20 77402133
Mob. +44(0)7958 379562
http://www.solidstategroup.com
More information about the opencms-dev
mailing list