private ServletModuleImages() {
- theLog = Logfile.getInstance(this.getClass().getName());
+ theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Bilder.Logfile"));
templateListString = MirConfig.getProp("ServletModule.Bilder.ListTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Bilder.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.Bilder.ConfirmTemplate");
EntityImages entImage = (EntityImages)mainModule.getById(id);
if (imageData!=null && fileName!=null) {
- String fileType = "-1";
-
- //the where clause to find the media_type entry
+ //the where clause to find the media_type entry
//from the content-type.
- //we use the media type entry to lookup the
+ //we use the media type entry to lookup the
//media Handler/Storage classes
String wc = " mime_type='"+contentType+"'";
EntityList mediaTypesList = DatabaseMediaType.getInstance().selectByWhereClause(wc);
- String mediaTypeId = null;
+ String mediaTypeId = null;
String mediaStorageName = null;
String mediaHandlerName = null;
-
+
//if we found an entry matching the
//content-type int the table.
if (mediaTypesList.size() > 0) {
mediaStorageName = mediaTypesList.elementAt(0).getValue("tablename");
mediaHandlerName = mediaTypesList.elementAt(0).getValue("classname");
parameters.put("to_media_type",mediaTypeId);
-
+
//load the classes via reflection
String MediaId;
try {
//were done with mpReq at this point, dereference it. as it contains
//mucho mem. -mh 01.10.2001
mpReq=null;
-
+
if(mediaId!=null){
new ProducerMedia().handle(null, null, false, false, mediaId);
}
- } catch (Exception e) {
- theLog.printError("setting uploaded_media failed: "+e.toString());
+ } catch (Exception e) {
+ theLog.printError("setting uploaded_media failed: "+e.toString());
} //end try-catch
- if (fileType != "-1")
- entImage.setImage(imageData, fileType);
- else
- theLog.printError("Wrong file uploaded!");
+ entImage.setImage(imageData);
}
_edit(id, req, res);
}
try {
WebdbMultipartRequest mp = new WebdbMultipartRequest(req);
HashMap parameters = mp.getParameters();
- MpRequest mpReq = (MpRequest)mp.requestList.get(0);
- byte[] imageData=mpReq.getMedia();
- String fileName=mpReq.getFilename();
- String contentType=mpReq.getContentType();
+ //MpRequest mpReq = (MpRequest)mp.requestList.get(0);
+ //byte[] imageData=mpReq.getMedia();
+ //String fileName=mpReq.getFilename();
+ //String contentType=mpReq.getContentType();
EntityUsers user = _getUser(req);
parameters.put("to_publisher", user.getId());
parameters.put("is_published","0");
String id = mainModule.set(parameters);
- EntityImages entImage = (EntityImages)mainModule.getById(id);
-
- if (imageData!=null && fileName!=null) {
- String fileType = "-1";
- if (contentType.equals("image/jpeg")) fileType="0";
- if (contentType.equals("image/gif")) fileType="1";
- if (fileType != "-1")
- entImage.setImage(imageData, fileType);
- else
- theLog.printError("Wrong file uploaded!");
- }
+ theLog.printError("Image ID"+id);
_edit(id, req, res);
}
catch (IOException e) { throw new ServletModuleException("upload -- ioexception " + e.toString());}
String fileName=mpReq.getFilename();
String contentType=mpReq.getContentType();
- String fileType = "-1";
- if (contentType.equals("image/jpeg")) fileType="0";
- if (contentType.equals("image/gif")) fileType="1";
- if (fileType != "-1") {
- EntityImages entImage = (EntityImages)mainModule.getById(idParam);
- entImage.setImage(imageData, fileType);
- }
- else
- theLog.printError("Wrong file uploaded!");
+ EntityImages entImage = (EntityImages)mainModule.getById(idParam);
+ entImage.setImage(imageData);
}
catch (IOException e) { throw new ServletModuleException("upload -- ioexception " + e.toString());}
catch (ModuleException e) { throw new ServletModuleException("upload -- moduleexception " + e.toString());}
+ catch (StorageObjectException e) { throw new ServletModuleException("upload -- storageobjectexception " + e.toString());}
}
else // keine id
throw new ServletModuleException("Keine id angegeben");